spark MLlib 中 setLabelCol 和 setPredictionCol 方法的区别
difference between setLabelCol and setPredictionCol methods in spark MLib
我在 spark Mlib 中使用逻辑回归进行分类,setLabelCol(
) 和 spark 中的 setPredictionCol()
方法有什么区别?
它们是为标签和预测设置非默认列名的两种方法
setLabelCol
(默认="label")用于在训练时设置标签的列名。例如。训练二元分类器时,您需要包含 1.0 或 0.0 的 'label'。该算法将使用它来训练模型。
setPredicionCol
(默认="prediction")用于设置模型在评分时输出的列名。例如。上面训练的二元分类器模型将向包含预测输出的 DataFrame 添加一个新列。
您可以使用 explainParams
查看可用参数、默认值和简要文档。例如
scala> new LogisticRegression().explainParams
res6: String =
...
featuresCol: features column name (default: features)
...
labelCol: label column name (default: label)
...
predictionCol: prediction column name (default: prediction)
probabilityCol: Column name for predicted class conditional probabilities.
...
我在 spark Mlib 中使用逻辑回归进行分类,setLabelCol(
) 和 spark 中的 setPredictionCol()
方法有什么区别?
它们是为标签和预测设置非默认列名的两种方法
setLabelCol
(默认="label")用于在训练时设置标签的列名。例如。训练二元分类器时,您需要包含 1.0 或 0.0 的 'label'。该算法将使用它来训练模型。setPredicionCol
(默认="prediction")用于设置模型在评分时输出的列名。例如。上面训练的二元分类器模型将向包含预测输出的 DataFrame 添加一个新列。
您可以使用 explainParams
查看可用参数、默认值和简要文档。例如
scala> new LogisticRegression().explainParams
res6: String =
...
featuresCol: features column name (default: features)
...
labelCol: label column name (default: label)
...
predictionCol: prediction column name (default: prediction)
probabilityCol: Column name for predicted class conditional probabilities.
...