クロス検証を高速化する方法How to speed up cross-validation
Apache SparkML モデルのハイパーパラメーターチューニングには、パラメーターグリッドのサイズに応じて非常に長い時間がかかります。Hyperparameter tuning of Apache SparkML models takes a very long time, depending on the size of the parameter grid. SparkML のクロス検証手順のパフォーマンスを向上させることで、処理速度を上げることができます。You can improve the performance of the cross-validation step in SparkML to speed things up:
- 相互検証を含む機能の変換やモデリングの手順を実行する前に、データをキャッシュします。Cache the data before running any feature transformations or modeling steps, including cross-validation. データを複数回参照するプロセスでは、キャッシュの利点が得られます。Processes that refer to the data multiple times benefit from a cache. キャッシュを有効にするには、に対するアクションを必ず呼び出してください
DataFrame
。Remember to call an action on theDataFrame
for the cache to take effect. CrossValidator
並列アルゴリズムを実行するときに使用するスレッドの数を設定する、内の並列処理パラメーターを増やします。Increase the parallelism parameter inside theCrossValidator
, which sets the number of threads to use when running parallel algorithms. 既定の設定は1です。The default setting is 1. 詳細については、 クロス検証のドキュメント を参照してください。See the CrossValidator documentation for more information.- 仕様内では、このパイプラインを推定として使用しないで
CrossValidator
ください。Don’t use the pipeline as the estimator inside theCrossValidator
specification. Featurizers がモデルと共にチューニングされている場合は、内でパイプライン全体を実行することが理にかなっていCrossValidator
ます。In some cases where the featurizers are being tuned along with the model, running the whole pipeline inside theCrossValidator
makes sense. ただし、これにより、すべてのパラメーターの組み合わせとフォールドに対してパイプライン全体が実行されます。However, this executes the entire pipeline for every parameter combination and fold. そのため、モデルのみをチューニングする場合は、モデル仕様を内の推定機能として設定しCrossValidator
ます。Therefore, if only the model is being tuned, set the model specification as the estimator inside theCrossValidator
.
注意
CrossValidator
featurizers の後に、パイプライン内の最終段階として設定できます。CrossValidator
can be set as the final stage inside the pipeline after the featurizers. によって識別される最適なモデル CrossValidator
は、出力です。The best model identified by the CrossValidator
is output.