Как выполнить поиск по сетке для Random Forest с использованием библиотеки Apache Spark ML

Сделайте cactus a prefab.

Затем создайте общедоступную переменную:

 public GameObject cactus;

Затем перетащите префикс в переменную скрипта через редактор. Затем вы можете создать экземпляр.

 if(cactus != null)
 {
    GameObject g = Instantiate(cactus, new Vector3(xCoB, childVector3.y, zCoB), randomRotation) as GameObject;

    g.name = "cactus";
 }
0
задан Regressor 15 January 2019 в 21:37
поделиться

1 ответ

from pyspark.ml import Pipeline
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.evaluation import BinaryClassificationEvaluator
from pyspark.ml.tuning import CrossValidator, ParamGridBuilder


rf = RandomForestClassifier(labelCol="indexedLabel", featuresCol="indexedFeatures", numTrees=10)
pipeline = Pipeline(stages=[rf])
paramGrid = ParamGridBuilder().addGrid(rf.numTrees, [10, 30]).build()

crossval = CrossValidator(estimator=pipeline,
                          estimatorParamMaps=paramGrid,
                          evaluator=BinaryClassificationEvaluator(),
                          numFolds=2) 

cvModel = crossval.fit(training_df)

гиперпараметры и сетка определены в методе addGrid

0
ответ дан o11306650 15 January 2019 в 21:37
поделиться
Другие вопросы по тегам:

Похожие вопросы: