0
所以我用這樣的代碼:星火決策樹無法解決trainClassifier方法
DecisionTree.trainClassifier((org.apache.spark.api.java.JavaRDD<LabeledPoint>)dtTraining, numClasses.intValue(), (java.util.Map<Integer,Integer>) categoricalFeaturesInfo,
impurity, maxDepth.intValue(), maxBins.intValue());
但有編譯錯誤:
[ERROR] method org.apache.spark.mllib.tree.DecisionTree.trainClassifier(org.apache.spark.rdd.RDD<org.apache.spark.mllib.regression.LabeledPoint>,int,scala.collection.immutable.Map<java.lang.Object,java.lang.Object>,java.lang.String,int,int) is not applicable
[ERROR] (argument mismatch; org.apache.spark.api.java.JavaRDD<org.apache.spark.ml.feature.LabeledPoint> cannot be converted to org.apache.spark.rdd.RDD<org.apache.spark.mllib.regression.LabeledPoint>)
所以編譯器沒有發現有效的方法在DecisionTree中。
在我的pom.xml我有:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>org.jpmml</groupId>
<artifactId>pmml-model</artifactId>
</exclusion>
</exclusions>
</dependency>
我期待到DecisionTree使用的多個例子,它似乎喜歡到處一切工作正常。有什麼可能是麻煩?