org.apache.spark.SparkException

Job aborted due to stage failure: Task 2 in stage 2.0 failed 1 times, most recent failure: Lost task 2.0 in stage 2.0 (TID 11, localhost): ml.dmlc.xgboost4j.java.XGBoostError: [14:43:22] src/metric/elementwise_metric.cc:28: Check failed: (preds.size()) == (info.labels.size()) label and prediction size not match, hint: use merror or mlogloss for multi-class classification

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web1

  • Stack trace

    • org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 2.0 failed 1 times, most recent failure: Lost task 2.0 in stage 2.0 (TID 11, localhost): ml.dmlc.xgboost4j.java.XGBoostError: [14:43:22] src/metric/elementwise_metric.cc:28: Check failed: (preds.size()) == (info.labels.size()) label and prediction size not match, hint: use merror or mlogloss for multi-class classification at ml.dmlc.xgboost4j.java.JNIErrorHandle.checkCall(JNIErrorHandle.java:48) at ml.dmlc.xgboost4j.java.Booster.evalSet(Booster.java:178) at ml.dmlc.xgboost4j.scala.Booster.evalSet(Booster.scala:97) at ml.dmlc.xgboost4j.scala.spark.XGBoostModel$$anonfun$1.apply(XGBoostModel.scala:80) at ml.dmlc.xgboost4j.scala.spark.XGBoostModel$$anonfun$1.apply(XGBoostModel.scala:62) at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:766) at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:766) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319) at org.apache.spark.rdd.RDD.iterator(RDD.scala:283) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319) at org.apache.spark.rdd.RDD.iterator(RDD.scala:283) at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:70) at org.apache.spark.scheduler.Task.run(Task.scala:85) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    We couldn't find other users who have seen this exception.