Description
Strategy strategy = new Strategy(Algo.Classification(), new Impurity() {
@Override
public double calculate(double arg0, double arg1, double arg2)
@Override
public double calculate(double arg0, double arg1)
}, 5, 100, QuantileStrategy.Sort(), null, 256);
DecisionTree decisionTree = new DecisionTree(strategy);
final DecisionTreeModel decisionTreeModel = decisionTree.train(labeledPoints.rdd());
i try to run it on spark, but find an error on the console:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;
at org.apache.spark.mllib.tree.DecisionTree$.findSplitsBins(DecisionTree.scala:990)
at org.apache.spark.mllib.tree.DecisionTree.train(DecisionTree.scala:56)
at org.project.modules.spark.java.SparkDecisionTree.main(SparkDecisionTree.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:292)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:55)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
i view source code, find
val numFeatures = input.take(1)(0).features.size
this is a problem.
Attachments
Issue Links
- relates to
-
SPARK-2478 Add Python APIs for decision tree
- Resolved
- requires
-
SPARK-2737 ClassCastExceptions when collect()ing JavaRDDs' underlying Scala RDDs
- Resolved
- links to