PMML evaluate on Windows

View: New views
3 Messages — Rating Filter:   Alert me  

PMML evaluate on Windows

by Craig Bruce-3 :: Rate this Message:

| View Threaded | Show Only this Message

Hi,
 
I've been testing the supplied Iris PMML models (MLR/MLP) from MailScanner has detected a possible fraud attempt from "60.234.220.81:8080" claiming to be MailScanner warning: numerical links are often malicious: http://60.234.220.81:8080/pmml/ programmatically. I can successfully load the model and data. However when I use Windows I get this error:
Exception in thread "main" java.lang.NoSuchMethodError: weka.classifiers.Evaluation.evaluateModel(Lweka/classifiers/Classifier;Lweka/core/Instances;[Ljava/lang/Object;)[D

at PMML.main(PMML.java:32)

I've tried using weka 3.6.0 and both current snapshots (dev & stable) on WinXP. The same code and files run fine on Mac OS X 10.4, although the GUI does briefly load.
 
What can I do to get this to work on Windows?
 
Cheers
Craig
 
 

This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.


import java.io.File;

import weka.classifiers.Evaluation;
import weka.classifiers.pmml.consumer.PMMLClassifier;
import weka.core.Instances;
import weka.core.converters.CSVLoader;
import weka.core.pmml.PMMLFactory;
import weka.core.pmml.PMMLModel;

public class PMML {

        public static void main(String[] args) throws Exception {
                // Load model
                PMMLModel model = PMMLFactory
                                .getPMMLModel("C:\\Documents and Settings\\craigb\\Desktop\\Iris_MLR.xml");
                System.out.println(model);

                // Load data
                CSVLoader loader = new CSVLoader();
                loader.setSource(new File(
                                "C:\\Documents and Settings\\craigb\\Desktop\\iris.csv"));

                Instances data;
                data = loader.getDataSet();
                data.setClassIndex(data.numAttributes() - 1);

                // Evaluate model
                if (model instanceof PMMLClassifier) {
                        PMMLClassifier mlr = (PMMLClassifier) model;

                        Evaluation eval = new Evaluation(data);
                        eval.evaluateModel(mlr, data);
                        System.out.println(eval.toSummaryString("Model", false));
                }
        }

}

_______________________________________________
Wekalist mailing list
Wekalist@...
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist

Re: PMML evaluate on Windows

by Mark Hall-9 :: Rate this Message:

| View Threaded | Show Only this Message

Hi Craig,

I have 3.6.0 installed under Windows XP and your program worked fine  
for me on the IRIS_MLP and Iris_MLR files. Have you checked your  
CLASSPATH in case there is an older version of Weka in there? I  
changed your program to accept the model file from arg[0] and the csv  
file from arg[1] and ran it with:

java -cp "C:\Program Files\Weka-3-6\weka.jar";. Iris_MLR.xml iris.csv

Cheers,
Mark.

On 22/01/2009, at 12:49 AM, Bruce Craig wrote:

> Hi,
>
> I've been testing the supplied Iris PMML models (MLR/MLP) from  
> MailScanner has detected a possible fraud attempt from  
> "60.234.220.81:8080" claiming to be MailScanner warning: numerical  
> links are often malicious: http://60.234.220.81:8080/pmml/ 
> programmatically. I can successfully load the model and data.  
> However when I use Windows I get this error:
> Exception in thread "main" java.lang.NoSuchMethodError:  
> weka.classifiers.Evaluation.evaluateModel(Lweka/classifiers/
> Classifier;Lweka/core/Instances;[Ljava/lang/Object;)[D
> at PMML.main(PMML.java:32)
>
> I've tried using weka 3.6.0 and both current snapshots (dev &  
> stable) on WinXP. The same code and files run fine on Mac OS X  
> 10.4, although the GUI does briefly load.
>
> What can I do to get this to work on Windows?
>
> Cheers
> Craig
>
>
>
> This message has been checked for viruses but the contents of an  
> attachment may still contain software viruses, which could damage  
> your computer system: you are advised to perform your own checks.  
> Email communications with the University of Nottingham may be  
> monitored as permitted by UK legislation.
>
> <PMML.java>
> _______________________________________________
> Wekalist mailing list
> Wekalist@...
> https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
--
Mark Hall
Senior Developer/Consultant, Pentaho Open Source Business Intelligence
Citadel International, Suite 340, 5950 Hazeltine National Dr.,
Orlando, FL 32822, USA
+64 7 847-3537 office, +64 21 399-132 mobile, +1 815 550-8637 fax,
Skype: mark.andrew.hall, Yahoo: mark_andrew_hall
Download the latest release today <http://www.sourceforge.net/ 
projects/pentaho>




_______________________________________________
Wekalist mailing list
Wekalist@...
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist

RE: PMML evaluate on Windows

by Craig Bruce-3 :: Rate this Message:

| View Threaded | Show Only this Message

Re: [Wekalist] PMML evaluate on Windows
> java -cp "C:\Program Files\Weka-3-6\weka.jar";. Iris_MLR.xml iris.csv
Turns out my classpath was the problem, I had another program (non-Weka), once that was removed it ran fine. Somewhat strange, but glad it works now.
 
Cheers
Craig

This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.


_______________________________________________
Wekalist mailing list
Wekalist@...
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist