2016-11-10 5 views
1

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 예를 들면 ml의 지원 http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.ml.evaluation.BinaryClassificationEvaluator 발견 데이터 세트. 지금까지 xgboost4j를 파이프 라인에 성공적으로 통합 할 수 없었습니다.

답변