Munirah
Munirah

Reputation: 11

How to load saved model created by (Weka GUI) into my java application and browse the predicted result

My model is done using "FilteredClassifier" algorithm, then SMO as a "classifier" parameter. "weka.classifiers.functions.SMO".

I tried to load my model into java using this code but it is not work

SupportVector SOM = (SupportVector) SerializationHelper.read(new 
FileInputStream("C:\\Users\\HP\\Desktop\\SOM.model"));

and this code

FilteredClassifier  SOM = (FilteredClassifier ) 
SerializationHelper.read(new 
FileInputStream("C:\\Users\\HP\\Desktop\\SOM.model"));

both not working

then I want to browse the data used in building this model (actual value and predicted value).

how I can do it? Once I have created the model, do I need to load the dataset again?

This is the error

Exception in thread "main" java.lang.ClassCastException: weka.classifiers.meta.FilteredClassifier cannot be cast to weka.core.pmml.jaxbbindings.SupportVector at weka.api.Model.main(Model.java:28)


This is the error

  Exception in thread "main" java.lang.ClassCastException: weka.classifiers.meta.FilteredClassifier cannot be cast to weka.core.pmml.jaxbbindings.SupportVector
at weka.api.Model.main(Model.java:28)

Upvotes: 1

Views: 220

Answers (1)

Pete Kirkham
Pete Kirkham

Reputation: 49311

weka.classifiers.meta.FilteredClassifier cannot be cast to weka.core.pmml.jaxbbindings.SupportVector

pmml and jaxb are XML related classes, you appear to have imported the wrong package.

Upvotes: 1

Related Questions