本文整理匯總了Python中pyspark.ml.tuning.CrossValidator.setEstimatorParamMaps方法的典型用法代碼示例。如果您正苦於以下問題:Python CrossValidator.setEstimatorParamMaps方法的具體用法?Python CrossValidator.setEstimatorParamMaps怎麽用?Python CrossValidator.setEstimatorParamMaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyspark.ml.tuning.CrossValidator
的用法示例。
在下文中一共展示了CrossValidator.setEstimatorParamMaps方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: BinaryClassificationEvaluator
# 需要導入模塊: from pyspark.ml.tuning import CrossValidator [as 別名]
# 或者: from pyspark.ml.tuning.CrossValidator import setEstimatorParamMaps [as 別名]
validpredicts = lrmodel.transform(adultvalid)
from pyspark.ml.evaluation import BinaryClassificationEvaluator
bceval = BinaryClassificationEvaluator()
bceval.evaluate(validpredicts)
bceval.getMetricName()
bceval.setMetricName("areaUnderPR")
bceval.evaluate(validpredicts)
#section 8.2.5
from pyspark.ml.tuning import CrossValidator
from pyspark.ml.tuning import ParamGridBuilder
cv = CrossValidator().setEstimator(lr).setEvaluator(bceval).setNumFolds(5)
paramGrid = ParamGridBuilder().addGrid(lr.maxIter, [1000]).addGrid(lr.regParam, [0.0001, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5]).build()
cv.setEstimatorParamMaps(paramGrid)
cvmodel = cv.fit(adulttrain)
cvmodel.bestModel.weights
BinaryClassificationEvaluator().evaluate(cvmodel.bestModel.transform(adultvalid))
#section 8.2.6
penschema = StructType([
StructField("pix1",DoubleType(),True),
StructField("pix2",DoubleType(),True),
StructField("pix3",DoubleType(),True),
StructField("pix4",DoubleType(),True),
StructField("pix5",DoubleType(),True),
StructField("pix6",DoubleType(),True),
StructField("pix7",DoubleType(),True),
StructField("pix8",DoubleType(),True),
StructField("pix9",DoubleType(),True),