あなたは食品会社に勤務しています。会社の過去の売上データはBigQueryに保存されています。BigQueryからデータを読み込み、将来の売上を予測する複数のTensorFlowモデルをトレーニングするために、Vertex AIのカスタムトレーニングサービスを使用する必要があります。モデルの実験を開始する前に、多数の特徴量に対して最小最大スケーリングとバケット化を実行するデータ前処理アルゴリズムを実装する予定です。
前処理にかかる時間、コスト、開発労力を最小限に抑えたい場合、このワークフローをどのように構成すればよいでしょうか?
正解: C
ワークフローを構成するための最良のオプションは、変換を TensorFlow モデルの前処理レイヤーとして追加することです。このオプションを使用すると、TensorFlow のパワーとシンプルさを活用して、シンプルな Python コードでデータを前処理および変換できます。TensorFlow は、機械学習モデルの構築とトレーニングのためのフレームワークです。TensorFlow は、データ分析と機械学習のためのさまざまなツールとライブラリを提供します。前処理レイヤーは、入力データに対してデータの前処理と特徴エンジニアリング操作を実行できる TensorFlow のレイヤーの一種です。前処理レイヤーを使用すると、データの変換と前処理ロジックをカスタマイズしたり、複雑なデータ形式や標準以外のデータ形式を処理したりできます。また、前処理レイヤーを実装するために数行のコードを記述するだけで済み、中間データソースやパイプラインを作成する必要がないため、前処理の時間、コスト、開発作業を最小限に抑えることができます。TensorFlow モデルの前処理レイヤーとして変換を追加することで、Vertex AI のカスタムトレーニング サービスを使用して、BigQuery からデータを読み取り、将来の売上を予測する複数の TensorFlow モデルをトレーニングできます。
他の選択肢は、以下の理由から選択肢Cほど優れていません。
* Option A: Writing the transformations into Spark that uses the spark-bigquery-connector and using Dataproc to preprocess the data would require more skills and steps than using a preprocessing layer in TensorFlow. Spark is a framework for distributed data processing and machine learning. Spark can read and write data from BigQuery by using the spark-bigquery-connector, which is a library that allows Spark to communicate with BigQuery. Dataproc is a service that can create and manage Spark clusters on Google Cloud. Dataproc can help you run Spark jobs on Google Cloud, and scale the clusters according to the workload. However, writing the transformations into Spark that uses the spark-bigquery-connector and using Dataproc to preprocess the data would require more skills and steps than using a preprocessing layer in TensorFlow. You would need to write code, create and configure the Spark cluster, install and import the spark-bigquery-connector, load and preprocess the data, and write the data back to BigQuery. Moreover, this option would create an intermediate data source in BigQuery, which can increase the storage and computation costs2.
* Option B: Writing SQL queries to transform the data in-place in BigQuery would not allow you to use Vertex AI's custom training service to train multiple TensorFlow models that read the data from BigQuery and predict future sales. BigQuery is a service that can perform data analysis and machine learning by using SQL queries. BigQuery can perform data transformation and preprocessing by using SQL functions and clauses, such as MIN, MAX, CASE, and TRANSFORM. BigQuery can also perform machine learning by using BigQuery ML, which is a feature that can create and train machine learning models by using SQL queries. However, writing SQL queries to transform the data in-place in BigQuery would not allow you to use Vertex AI's custom training service to train multiple TensorFlow models that read the data from BigQuery and predict future sales. Vertex AI's custom training service is a service that can run your custom machine learning code on Vertex AI. Vertex AI's custom training service can support various machine learning frameworks, such as TensorFlow, PyTorch, and scikit-learn. Vertex AI's custom training service cannot support SQL queries, as SQL is not a machine learning framework. Therefore, if you want to use Vertex AI's custom training service, you cannot use SQL queries to transform the data in-place in BigQuery3.
* オプション D: BigQueryIO コネクタを使用してデータを取り込み、処理し、BigQuery に書き戻す Dataflow パイプラインを作成するには、TensorFlow で前処理レイヤーを使用するよりも多くのスキルと手順が必要になります。 Dataflow は、Google Cloud 上でデータ処理および機械学習パイプラインを作成して実行できるサービスです。 Dataflow は、BigQuery と通信できるようにするライブラリである BigQueryIO コネクタを使用して、BigQuery からデータを読み書きできます。 Dataflow は、分散データ処理および機械学習のフレームワークである Apache Beam を使用して、データ変換および前処理を実行できます。 ただし、BigQueryIO コネクタを使用してデータを取り込み、処理し、BigQuery に書き戻す Dataflow パイプラインを作成するには、TensorFlow で前処理レイヤーを使用するよりも多くのスキルと手順が必要になります。 コードを記述し、Dataflow パイプラインを作成して構成し、BigQueryIO コネクタをインストールしてインポートし、データをロードして前処理し、データを BigQuery に書き戻す必要があります。 さらに、このオプションでは BigQuery に中間データ ソースが作成されるため、ストレージと計算コストが増加する可能性があります 4。
参考文献:
* Google Cloud認定資格の準備:機械学習エンジニア、コース3:本番環境向け機械学習システム、第2週:機械学習予測の提供
* Google Cloud Professional Machine Learning Engineer 試験ガイド、セクション 2: ML モデルの開発、2.1 TensorFlow を使用した ML モデルの開発
* Google Cloud 認定プロフェッショナル機械学習エンジニア公式学習ガイド、第 4 章:
機械学習モデルの開発、第4.1節:TensorFlowを使用した機械学習モデルの開発
* TensorFlowの前処理レイヤー
* SparkとBigQuery
* データ処理
* BigQuery ML
* DataflowとBigQuery
* アパッチビーム