xgboost4jをspark 2.0.1とDataset APIで使用しようとしています。これまでのところ私はmodel.transform(testData)
xgboost4j - スパーク評価にはRDDが必要です[(Double、Double)]
predictions.printSchema
root
|-- label: double (nullable = true)
|-- features: vector (nullable = true)
|-- probabilities: vector (nullable = true)
|-- prediction: double (nullable = true)
+-----+--------------------+--------------------+----------+
|label| features| probabilities|prediction|
+-----+--------------------+--------------------+----------+
| 0.0|[0.0,1.0,0.0,476....|[0.96766251325607...| 0.0|
| 0.0|[0.0,1.0,0.0,642....|[0.99599152803421...| 0.0|
を使用して、次の形式での予測を得た。しかし、今、私は、評価指標を生成したいと思います。予測を適切な形式にマップするにはどうすればよいですか? XGBoost-4j by DMLC on Spark-1.6.1も同様の問題を提案していますが、私はそれを私のために働かせることはできませんでした。代わりに
root
|-- label: double (nullable = true)
|-- prediction: double (nullable = true)
Trypingのような必要なタプルにマッピングするように見えるpredictions.select("prediction", "label")
の
val metrics = new BinaryClassificationMetrics(predictions.select("prediction", "label").rdd)
would require RDD[(Double, Double)]
:
predictions.select("prediction", "label").map{case Row(_) => (_,_)}
も同様に動作しません。火花のドキュメントでより多くのビットを読み出す
編集
は、私が代わりにML-LIB例えばミリリットルをサポートhttp://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.ml.evaluation.BinaryClassificationEvaluatorを見つけましたデータセット。これまでのところ、私はxgboost4jをパイプラインにうまく統合できませんでした。