You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Joseph K. Bradley (JIRA)" <ji...@apache.org> on 2014/07/30 02:20:38 UTC

[jira] [Comment Edited] (SPARK-2197) Spark invoke DecisionTree by Java

    [ https://issues.apache.org/jira/browse/SPARK-2197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14078675#comment-14078675 ] 

Joseph K. Bradley edited comment on SPARK-2197 at 7/30/14 12:18 AM:
--------------------------------------------------------------------

This error is at least partly caused by issues with collect() inside DecisionTree: https://issues.apache.org/jira/browse/SPARK-2737


was (Author: josephkb):
This error is at least partly caused by issues with collect() inside DecisionTree.

> Spark invoke DecisionTree by Java
> ---------------------------------
>
>                 Key: SPARK-2197
>                 URL: https://issues.apache.org/jira/browse/SPARK-2197
>             Project: Spark
>          Issue Type: Bug
>          Components: MLlib
>            Reporter: wulin
>            Assignee: Joseph K. Bradley
>
> Strategy strategy = new Strategy(Algo.Classification(), new Impurity() {
> 			@Override
> 			public double calculate(double arg0, double arg1, double arg2) {
> 				return Gini.calculate(arg0, arg1, arg2);
> 			}
> 			@Override
> 			public double calculate(double arg0, double arg1) {
> 				return Gini.calculate(arg0, 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)