weka.core.pmml
Class PMMLFactory

java.lang.Object
  extended by weka.core.pmml.PMMLFactory

public class PMMLFactory
extends Object

This class is a factory class for reading/writing PMML models

Version:
$Revision: 8034 $
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}com)

Constructor Summary
PMMLFactory()
           
 
Method Summary
static String applyClassifier(PMMLModel model, Instances test)
           
static PMMLModel getPMMLModel(File file)
          Read and return a PMML model.
static PMMLModel getPMMLModel(File file, Logger log)
          Read and return a PMML model.
static PMMLModel getPMMLModel(InputStream stream)
          Read and return a PMML model.
static PMMLModel getPMMLModel(InputStream stream, Logger log)
          Read and return a PMML model.
static PMMLModel getPMMLModel(String filename)
          Read and return a PMML model.
static PMMLModel getPMMLModel(String filename, Logger log)
          Read and return a PMML model.
static void main(String[] args)
           
static void serializePMMLModel(PMMLModel model, File file)
          Serialize a PMMLModel object that encapsulates a PMML model
static void serializePMMLModel(PMMLModel model, OutputStream stream)
          Serialize a PMMLModel object that encapsulates a PMML model
static void serializePMMLModel(PMMLModel model, String filename)
          Serialize a PMMLModel object that encapsulates a PMML model
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PMMLFactory

public PMMLFactory()
Method Detail

getPMMLModel

public static PMMLModel getPMMLModel(String filename)
                              throws Exception
Read and return a PMML model.

Parameters:
filename - the name of the file to read from
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading the file

getPMMLModel

public static PMMLModel getPMMLModel(File file)
                              throws Exception
Read and return a PMML model.

Parameters:
file - a File to read from
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading the file

getPMMLModel

public static PMMLModel getPMMLModel(InputStream stream)
                              throws Exception
Read and return a PMML model.

Parameters:
stream - the InputStream to read from
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading from the stream

getPMMLModel

public static PMMLModel getPMMLModel(String filename,
                                     Logger log)
                              throws Exception
Read and return a PMML model.

Parameters:
filename - the name of the file to read from
log - the logging object to use (or null if none is to be used)
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading the file

getPMMLModel

public static PMMLModel getPMMLModel(File file,
                                     Logger log)
                              throws Exception
Read and return a PMML model.

Parameters:
file - a File to read from
log - the logging object to use (or null if none is to be used)
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading the file

getPMMLModel

public static PMMLModel getPMMLModel(InputStream stream,
                                     Logger log)
                              throws Exception
Read and return a PMML model.

Parameters:
stream - the InputStream to read from
log - the logging object to use (or null if none is to be used)
Returns:
a PMML model
Throws:
Exception - if there is a problem while reading from the stream

serializePMMLModel

public static void serializePMMLModel(PMMLModel model,
                                      String filename)
                               throws Exception
Serialize a PMMLModel object that encapsulates a PMML model

Parameters:
model - the PMMLModel to serialize
filename - the name of the file to save to
Throws:
Exception - if something goes wrong during serialization

serializePMMLModel

public static void serializePMMLModel(PMMLModel model,
                                      File file)
                               throws Exception
Serialize a PMMLModel object that encapsulates a PMML model

Parameters:
model - the PMMLModel to serialize
file - the File to save to
Throws:
Exception - if something goes wrong during serialization

serializePMMLModel

public static void serializePMMLModel(PMMLModel model,
                                      OutputStream stream)
                               throws Exception
Serialize a PMMLModel object that encapsulates a PMML model

Parameters:
model - the PMMLModel to serialize
stream - the OutputStream to serialize to
Throws:
Exception - if something goes wrong during serialization

applyClassifier

public static String applyClassifier(PMMLModel model,
                                     Instances test)
                              throws Exception
Throws:
Exception

main

public static void main(String[] args)


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.