spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jake Lim <itwiza...@gmail.com>
Subject Q about Spark MLlib- Decision tree - scala.MatchError: 2.0 (of class java.lang.Double)
Date Mon, 15 Dec 2014 05:46:12 GMT
I am working some kind of Spark MLlib Test(Decision Tree) and I used IRIS
data from Cran-R package.
Original IRIS Data is not a good format for Spark MLlib. so I changed data
format(change data format and features's location)

When I ran sample Spark MLlib code for DT, I met the error like below
How can i solve this error?
==============================================================
14/12/15 14:27:30 ERROR TaskSetManager: Task 21.0:0 failed 4 times; aborting
job
14/12/15 14:27:30 INFO TaskSchedulerImpl: Cancelling stage 21
14/12/15 14:27:30 INFO DAGScheduler: Failed to run aggregate at
DecisionTree.scala:657
14/12/15 14:27:30 INFO TaskSchedulerImpl: Stage 21 was cancelled
14/12/15 14:27:30 WARN TaskSetManager: Loss was due to
org.apache.spark.TaskKilledException
org.apache.spark.TaskKilledException
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:178)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
14/12/15 14:27:30 INFO TaskSchedulerImpl: Removed TaskSet 21.0, whose tasks
have all completed, from pool
org.apache.spark.SparkException: Job aborted due to stage failure: Task
21.0:0 failed 4 times, most recent failure: Exception failure in TID 34 on
host krbda1anode01.kr.test.com: scala.MatchError: 2.0 (of class
java.lang.Double)
       
org.apache.spark.mllib.tree.DecisionTree$.classificationBinSeqOp$1(DecisionTree.scala:568)
       
org.apache.spark.mllib.tree.DecisionTree$.org$apache$spark$mllib$tree$DecisionTree$$binSeqOp$1(DecisionTree.scala:623)
       
org.apache.spark.mllib.tree.DecisionTree$$anonfun$4.apply(DecisionTree.scala:657)
       
org.apache.spark.mllib.tree.DecisionTree$$anonfun$4.apply(DecisionTree.scala:657)
       
scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
       
scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
        scala.collection.Iterator$class.foreach(Iterator.scala:727)
        scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
       
scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
        scala.collection.AbstractIterator.foldLeft(Iterator.scala:1157)
       
scala.collection.TraversableOnce$class.aggregate(TraversableOnce.scala:201)
        scala.collection.AbstractIterator.aggregate(Iterator.scala:1157)
        org.apache.spark.rdd.RDD$$anonfun$21.apply(RDD.scala:838)
        org.apache.spark.rdd.RDD$$anonfun$21.apply(RDD.scala:838)
       
org.apache.spark.SparkContext$$anonfun$23.apply(SparkContext.scala:1116)
       
org.apache.spark.SparkContext$$anonfun$23.apply(SparkContext.scala:1116)
        org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:111)
        org.apache.spark.scheduler.Task.run(Task.scala:51)
       
org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:187)
       
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        java.lang.Thread.run(Thread.java:745)
Driver stacktrace:
	at
org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1033)
	at
org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1017)
	at
org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1015)
	at
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
	at
org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1015)
	at
org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:633)
	at
org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:633)
	at scala.Option.foreach(Option.scala:236)
	at
org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:633)
	at
org.apache.spark.scheduler.DAGSchedulerEventProcessActor$$anonfun$receive$2.applyOrElse(DAGScheduler.scala:1207)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498)
	at akka.actor.ActorCell.invoke(ActorCell.scala:456)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237)
	at akka.dispatch.Mailbox.run(Mailbox.scala:219)
	at
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
==============================================================

input data is ( first column means species. 1 =setosa 2 => versicolor)

1,5.1,3.5,1.4,0.2
1,4.9,3,1.4,0.2
1,4.7,3.2,1.3,0.2
1,4.6,3.1,1.5,0.2
1,5,3.6,1.4,0.2
1,5.4,3.9,1.7,0.4
2,4.6,3.4,1.4,0.3
2,5,3.4,1.5,0.2
2,4.4,2.9,1.4,0.2
2,4.9,3.1,1.5,0.1
2,5.4,3.7,1.5,0.2
2,4.8,3.4,1.6,0.2
2,4.8,3,1.4,0.1


sample Spark MLlib Decision tree code is 

import org.apache.spark.SparkContext
import org.apache.spark.mllib.tree.DecisionTree
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.tree.configuration.Algo._
import org.apache.spark.mllib.tree.impurity.Gini

// Load and parse the data file
val data = sc.textFile("dt_R.csv")
val parsedData = data.map { line =>
  val parts = line.split(',').map(_.toDouble)
  LabeledPoint(parts(0), Vectors.dense(parts.tail))
}

// Run training algorithm to build the model
val maxDepth = 3
val model = DecisionTree.train(parsedData, Classification, Gini, maxDepth)





--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Q-about-Spark-MLlib-Decision-tree-scala-MatchError-2-0-of-class-java-lang-Double-tp20678.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message