spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Md. Rezaul Karim" <rezaul.ka...@insight-centre.org>
Subject RBackendHandler Error while running ML algorithms with SparkR on RStudio
Date Tue, 03 Jan 2017 15:14:00 GMT
Dear Spark Users,

I was trying to execute RandomForest and NaiveBayes algorithms on RStudio
but experiencing the following error:

17/01/03 15:04:11 ERROR RBackendHandler: fit on
org.apache.spark.ml.r.NaiveBayesWrapper
failed
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.
    java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.spark.api.r.RBackendHandler.handleMethodCall(
RBackendHandler.scala:141)
Caused by: java.io.IOException: Class not found
    at org.apache.xbean.asm5.ClassReader.a(Unknown Source)
    at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
Error in invokeJava(isStatic = TRUE, className, methodName, ...) :
  java.io.IOException: Class not found

Here's my source code:

Sys.setenv(SPARK_HOME = "spark-2.1.0-bin-hadoop2.7")
.libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))

library(SparkR)
sparkR.session(appName = "SparkR-NB", master = "local[*]", sparkConfig =
list(spark.driver.memory = "2g"))

# Fit a Bernoulli naive Bayes model with spark.naiveBayes
titanic <- as.data.frame(Titanic)
titanicDF <- createDataFrame(titanic[titanic$Freq > 0, -5])
nbDF <- titanicDF
nbTestDF <- titanicDF
nbModel <- spark.naiveBayes(nbDF, Survived ~ Class + Sex + Age)

# Model summary
summary(nbModel)

# Prediction
nbPredictions <- predict(nbModel, nbTestDF)
showDF(nbPredictions)




Someone please help me to get rid of this error.


Regards,
_________________________________
*Md. Rezaul Karim* BSc, MSc
PhD Researcher, INSIGHT Centre for Data Analytics
National University of Ireland, Galway
IDA Business Park, Dangan, Galway, Ireland
Web: http://www.reza-analytics.eu/index.html
<http://139.59.184.114/index.html>

Mime
View raw message