Package weka.core.pmml
Class PMMLFactory
- java.lang.Object
-
- weka.core.pmml.PMMLFactory
-
public class PMMLFactory extends java.lang.Object
This class is a factory class for reading/writing PMML models- Version:
- $Revision: 5562 $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
-
-
Constructor Summary
Constructors Constructor Description PMMLFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
applyClassifier(PMMLModel model, Instances test)
static PMMLModel
getPMMLModel(java.io.File file)
Read and return a PMML model.static PMMLModel
getPMMLModel(java.io.File file, Logger log)
Read and return a PMML model.static PMMLModel
getPMMLModel(java.io.InputStream stream)
Read and return a PMML model.static PMMLModel
getPMMLModel(java.io.InputStream stream, Logger log)
Read and return a PMML model.static PMMLModel
getPMMLModel(java.lang.String filename)
Read and return a PMML model.static PMMLModel
getPMMLModel(java.lang.String filename, Logger log)
Read and return a PMML model.static void
main(java.lang.String[] args)
static void
serializePMMLModel(PMMLModel model, java.io.File file)
Serialize aPMMLModel
object that encapsulates a PMML modelstatic void
serializePMMLModel(PMMLModel model, java.io.OutputStream stream)
Serialize aPMMLModel
object that encapsulates a PMML modelstatic void
serializePMMLModel(PMMLModel model, java.lang.String filename)
Serialize aPMMLModel
object that encapsulates a PMML model
-
-
-
Method Detail
-
getPMMLModel
public static PMMLModel getPMMLModel(java.lang.String filename) throws java.lang.Exception
Read and return a PMML model.- Parameters:
filename
- the name of the file to read from- Returns:
- a PMML model
- Throws:
java.lang.Exception
- if there is a problem while reading the file
-
getPMMLModel
public static PMMLModel getPMMLModel(java.io.File file) throws java.lang.Exception
Read and return a PMML model.- Parameters:
file
- aFile
to read from- Returns:
- a PMML model
- Throws:
java.lang.Exception
- if there is a problem while reading the file
-
getPMMLModel
public static PMMLModel getPMMLModel(java.io.InputStream stream) throws java.lang.Exception
Read and return a PMML model.- Parameters:
stream
- theInputStream
to read from- Returns:
- a PMML model
- Throws:
java.lang.Exception
- if there is a problem while reading from the stream
-
getPMMLModel
public static PMMLModel getPMMLModel(java.lang.String filename, Logger log) throws java.lang.Exception
Read and return a PMML model.- Parameters:
filename
- the name of the file to read fromlog
- the logging object to use (or null if none is to be used)- Returns:
- a PMML model
- Throws:
java.lang.Exception
- if there is a problem while reading the file
-
getPMMLModel
public static PMMLModel getPMMLModel(java.io.File file, Logger log) throws java.lang.Exception
Read and return a PMML model.- Parameters:
file
- aFile
to read fromlog
- the logging object to use (or null if none is to be used)- Returns:
- a PMML model
- Throws:
java.lang.Exception
- if there is a problem while reading the file
-
getPMMLModel
public static PMMLModel getPMMLModel(java.io.InputStream stream, Logger log) throws java.lang.Exception
Read and return a PMML model.- Parameters:
stream
- theInputStream
to read fromlog
- the logging object to use (or null if none is to be used)- Throws:
java.lang.Exception
- if there is a problem while reading from the stream
-
serializePMMLModel
public static void serializePMMLModel(PMMLModel model, java.lang.String filename) throws java.lang.Exception
Serialize aPMMLModel
object that encapsulates a PMML model- Parameters:
model
- thePMMLModel
to serializefilename
- the name of the file to save to- Throws:
java.lang.Exception
- if something goes wrong during serialization
-
serializePMMLModel
public static void serializePMMLModel(PMMLModel model, java.io.File file) throws java.lang.Exception
Serialize aPMMLModel
object that encapsulates a PMML model- Parameters:
model
- thePMMLModel
to serializefile
- theFile
to save to- Throws:
java.lang.Exception
- if something goes wrong during serialization
-
serializePMMLModel
public static void serializePMMLModel(PMMLModel model, java.io.OutputStream stream) throws java.lang.Exception
Serialize aPMMLModel
object that encapsulates a PMML model- Parameters:
model
- thePMMLModel
to serializestream
- theOutputStream
to serialize to- Throws:
java.lang.Exception
- if something goes wrong during serialization
-
applyClassifier
public static java.lang.String applyClassifier(PMMLModel model, Instances test) throws java.lang.Exception
- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args)
-
-