スコアを付けたいデータを読み込みます。データは、次のようにlibsvm形式 に格納されます。label index1:value1 index2:value2 ...( インデックスは1から始まり昇順になります)
100 10:1 11:1 208:1〜400:1 1830:1ここlibsvmデータの採点でLogisticRegressionModelが失敗するのはなぜですか?
val unseendata: RDD[LabeledPoint] = MLUtils.loadLibSVMFile(sc,unseendatafileName)
val scores_path = results_base + run_id + "/" + "-scores"
// Load the saved model
val lrm = LogisticRegressionModel.load(sc,"logisticregressionmodels/mymodel")
// I had saved the model after the training using save method. Here is the metadate for that model LogisticRegressionModel/mymodel/metadata/part-00000
{"class":"org.apache.spark.mllib.classification.LogisticRegressionModel","version":"1.0","numFeatures":176894,"numClasses":2}
// Evaluate model on unseen data
var valuesAndPreds = unseendata.map { point =>
var prediction = lrm.predict(point.features)
(point.label, prediction)
}
// Store the scores
valuesAndPreds.saveAsTextFile(scores_path)
Iが得るエラーメッセージである:
16/04/28十時22分07秒はTaskSetManagerに警告:失われたタスク0.0でステージ3.0(TID 5):java.lang.IllegalArgumentException: 必要条件はscala.Predef $ .require(Predef.scala:221)のところで org.apache.spark.mllib.classification.LogisticRegressionModel.predictPoint(LogisticRegression.scala:105) at org.apache.spark.mllib.regression .GeneralizedLinearModel.predict(GeneralizedLinearAlgorithm.scala:76)