在Spark上执行情感分析时出现java.lang.StackOverflowError错误(由于map功能)

时间:2019-03-29 13:07:12

标签: scala apache-spark sentiment-analysis

我们正在训练使用Hadoop对Twitter数据执行情感分析,并且我们从Spark收到以上错误,我们认为这与地图功能有关。

var labelAndPredsTrain = trainingData.map { point => 
  val prediction = model.predict(point.features)
  Tuple2(point.label, prediction)}

var labelAndPredsValid = validationData.map { point =>
  val prediction = model.predict(point.features)
  Tuple2(point.label, prediction)
}

错误:

java.lang.StackOverflowError
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:57)
  at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
  at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
  at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:112)
  at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:340)
  at java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1420)
  at java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:72)
  at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:497)
  at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:472)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:472)
  at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:369)

0 个答案:

没有答案