Failed to load class for data source: Libsvm in sp

2019-09-09 19:44发布

问题:

When I try to import a libsvm file in pyspark/scala using "sqlContext.read.format("libsvm").load", I get the following error -

"Failed to load class for data source: Libsvm."

At the same time, if I use "MLUtils.loadLibSVMFile" it works perfectly fine. I need to use both Spark ML (to get class probabilities) and MLlib for an evaluation. Have attached the error screenshot.

This is a MapR cluster. Spark version 1.5.2 Error

回答1:

libsvm source format is available since version 1.6 of Spark.



回答2:

this is probably a version mismatch, the version of libsvm you have in your project may not have that particular API, can you verify the version of libsvm is loaded and then determine if that api is available?