You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Jack Yang <ji...@uow.edu.au> on 2014/07/18 08:52:09 UTC

error from DecisonTree Training:

Hi All,
I got an error while using DecisionTreeModel (my program is written in Java, spark 1.0.1, scala 2.10.1).
I have read a local file, loaded it as RDD, and then sent to decisionTree for training. See below for details:

JavaRDD<LabeledPoint> Points = lines.map(new ParsePoint()).cache();
LogisticRegressionModel model = LogisticRegressionWithSGD.train(Points.rdd(),iterations, stepSize);   // until here it is working
Strategy strategy = new Strategy( ....);
DecisionTree decisionTree = new DecisionTree(strategy);
DecisionTreeModel decisionTreeModel = decisionTree.train(Points.rdd());


The error is : java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;

Any thoughts?

Best regards,
Jack


Re: error from DecisonTree Training:

Posted by Joseph Bradley <jo...@databricks.com>.
Following up, this bug with using DecisionTree with Java has been fixed,
and this update is in the current release candidate for 1.1.  It also
include some more Java-friendly constructors trainClassifier() and
trainRegressor().
Joseph


On Mon, Jul 21, 2014 at 4:41 PM, Jack Yang <ji...@uow.edu.au> wrote:

> That is nice.
> Thanks Xiangrui.
>
> -----Original Message-----
> From: Xiangrui Meng [mailto:mengxr@gmail.com]
> Sent: Tuesday, 22 July 2014 9:31 AM
> To: user@spark.apache.org
> Subject: Re: error from DecisonTree Training:
>
> This is a known issue:
> https://issues.apache.org/jira/browse/SPARK-2197 . Joseph is working on
> it. -Xiangrui
>
> On Mon, Jul 21, 2014 at 4:20 PM, Jack Yang <ji...@uow.edu.au> wrote:
> > So this is a bug unsolved (for java) yet?
> >
> >
> >
> > From: Jack Yang [mailto:jiey@uow.edu.au]
> > Sent: Friday, 18 July 2014 4:52 PM
> > To: user@spark.apache.org
> > Subject: error from DecisonTree Training:
> >
> >
> >
> > Hi All,
> >
> > I got an error while using DecisionTreeModel (my program is written in
> > Java, spark 1.0.1, scala 2.10.1).
> >
> > I have read a local file, loaded it as RDD, and then sent to
> > decisionTree for training. See below for details:
> >
> >
> >
> > JavaRDD<LabeledPoint> Points = lines.map(new ParsePoint()).cache();
> >
> > LogisticRegressionModel model =
> > LogisticRegressionWithSGD.train(Points.rdd(),iterations, stepSize);   //
> > until here it is working
> >
> > Strategy strategy = new Strategy( ….);
> >
> > DecisionTree decisionTree = new DecisionTree(strategy);
> >
> > DecisionTreeModel decisionTreeModel =
> > decisionTree.train(Points.rdd());
> >
> >
> >
> >
> >
> > The error is : java.lang.ClassCastException: [Ljava.lang.Object;
> > cannot be cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;
> >
> >
> >
> > Any thoughts?
> >
> >
> >
> > Best regards,
> >
> > Jack
> >
> >
>

RE: error from DecisonTree Training:

Posted by Jack Yang <ji...@uow.edu.au>.
That is nice.
Thanks Xiangrui.

-----Original Message-----
From: Xiangrui Meng [mailto:mengxr@gmail.com] 
Sent: Tuesday, 22 July 2014 9:31 AM
To: user@spark.apache.org
Subject: Re: error from DecisonTree Training:

This is a known issue:
https://issues.apache.org/jira/browse/SPARK-2197 . Joseph is working on it. -Xiangrui

On Mon, Jul 21, 2014 at 4:20 PM, Jack Yang <ji...@uow.edu.au> wrote:
> So this is a bug unsolved (for java) yet?
>
>
>
> From: Jack Yang [mailto:jiey@uow.edu.au]
> Sent: Friday, 18 July 2014 4:52 PM
> To: user@spark.apache.org
> Subject: error from DecisonTree Training:
>
>
>
> Hi All,
>
> I got an error while using DecisionTreeModel (my program is written in 
> Java, spark 1.0.1, scala 2.10.1).
>
> I have read a local file, loaded it as RDD, and then sent to 
> decisionTree for training. See below for details:
>
>
>
> JavaRDD<LabeledPoint> Points = lines.map(new ParsePoint()).cache();
>
> LogisticRegressionModel model =
> LogisticRegressionWithSGD.train(Points.rdd(),iterations, stepSize);   //
> until here it is working
>
> Strategy strategy = new Strategy( ….);
>
> DecisionTree decisionTree = new DecisionTree(strategy);
>
> DecisionTreeModel decisionTreeModel = 
> decisionTree.train(Points.rdd());
>
>
>
>
>
> The error is : java.lang.ClassCastException: [Ljava.lang.Object; 
> cannot be cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;
>
>
>
> Any thoughts?
>
>
>
> Best regards,
>
> Jack
>
>

Re: error from DecisonTree Training:

Posted by Xiangrui Meng <me...@gmail.com>.
This is a known issue:
https://issues.apache.org/jira/browse/SPARK-2197 . Joseph is working
on it. -Xiangrui

On Mon, Jul 21, 2014 at 4:20 PM, Jack Yang <ji...@uow.edu.au> wrote:
> So this is a bug unsolved (for java) yet?
>
>
>
> From: Jack Yang [mailto:jiey@uow.edu.au]
> Sent: Friday, 18 July 2014 4:52 PM
> To: user@spark.apache.org
> Subject: error from DecisonTree Training:
>
>
>
> Hi All,
>
> I got an error while using DecisionTreeModel (my program is written in Java,
> spark 1.0.1, scala 2.10.1).
>
> I have read a local file, loaded it as RDD, and then sent to decisionTree
> for training. See below for details:
>
>
>
> JavaRDD<LabeledPoint> Points = lines.map(new ParsePoint()).cache();
>
> LogisticRegressionModel model =
> LogisticRegressionWithSGD.train(Points.rdd(),iterations, stepSize);   //
> until here it is working
>
> Strategy strategy = new Strategy( ….);
>
> DecisionTree decisionTree = new DecisionTree(strategy);
>
> DecisionTreeModel decisionTreeModel = decisionTree.train(Points.rdd());
>
>
>
>
>
> The error is : java.lang.ClassCastException: [Ljava.lang.Object; cannot be
> cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;
>
>
>
> Any thoughts?
>
>
>
> Best regards,
>
> Jack
>
>

RE: error from DecisonTree Training:

Posted by Jack Yang <ji...@uow.edu.au>.
So this is a bug unsolved (for java) yet?

From: Jack Yang [mailto:jiey@uow.edu.au]
Sent: Friday, 18 July 2014 4:52 PM
To: user@spark.apache.org
Subject: error from DecisonTree Training:

Hi All,
I got an error while using DecisionTreeModel (my program is written in Java, spark 1.0.1, scala 2.10.1).
I have read a local file, loaded it as RDD, and then sent to decisionTree for training. See below for details:

JavaRDD<LabeledPoint> Points = lines.map(new ParsePoint()).cache();
LogisticRegressionModel model = LogisticRegressionWithSGD.train(Points.rdd(),iterations, stepSize);   // until here it is working
Strategy strategy = new Strategy( ....);
DecisionTree decisionTree = new DecisionTree(strategy);
DecisionTreeModel decisionTreeModel = decisionTree.train(Points.rdd());


The error is : java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.mllib.regression.LabeledPoint;

Any thoughts?

Best regards,
Jack