public class PMMLFactory
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
PMMLFactory.ModelType
for serialization
|
| Constructor and Description |
|---|
PMMLFactory() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
applyClassifier(PMMLModel model,
Instances test) |
protected static Instances |
getDataDictionaryAsInstances(org.w3c.dom.Document doc)
Get the data dictionary as an Instances object
|
protected static Instances |
getMiningSchemaAsInstances(org.w3c.dom.Element model,
Instances dataDictionary)
Deprecated.
Use the MiningSchema class instead
|
protected static org.w3c.dom.Element |
getModelElement(org.w3c.dom.Document doc,
PMMLFactory.ModelType modelType)
Get the Element that contains the pmml model
|
protected static PMMLModel |
getModelInstance(org.w3c.dom.Document doc,
PMMLFactory.ModelType modelType,
org.w3c.dom.Element model,
Instances dataDictionary,
MiningSchema miningSchema)
Get an instance of a PMMLModel from the supplied Document
|
protected static PMMLFactory.ModelType |
getModelType(org.w3c.dom.Document doc)
Get the type of model
|
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.
|
protected static weka.core.pmml.TransformationDictionary |
getTransformationDictionary(org.w3c.dom.Document doc,
Instances dataDictionary)
Get the transformation dictionary (if there is one).
|
static void |
main(java.lang.String[] args) |
static void |
serializePMMLModel(PMMLModel model,
java.io.File file)
Serialize a
PMMLModel object that encapsulates a PMML model |
static void |
serializePMMLModel(PMMLModel model,
java.io.OutputStream stream)
Serialize a
PMMLModel object that encapsulates a PMML model |
static void |
serializePMMLModel(PMMLModel model,
java.lang.String filename)
Serialize a
PMMLModel object that encapsulates a PMML model |
public static PMMLModel getPMMLModel(java.lang.String filename) throws java.lang.Exception
filename - the name of the file to read fromjava.lang.Exception - if there is a problem while reading the filepublic static PMMLModel getPMMLModel(java.io.File file) throws java.lang.Exception
file - a File to read fromjava.lang.Exception - if there is a problem while reading the filepublic static PMMLModel getPMMLModel(java.io.InputStream stream) throws java.lang.Exception
stream - the InputStream to read fromjava.lang.Exception - if there is a problem while reading from the streampublic static PMMLModel getPMMLModel(java.lang.String filename, Logger log) throws java.lang.Exception
filename - the name of the file to read fromlog - the logging object to use (or null if none is to be used)java.lang.Exception - if there is a problem while reading the filepublic static PMMLModel getPMMLModel(java.io.File file, Logger log) throws java.lang.Exception
file - a File to read fromlog - the logging object to use (or null if none is to be used)java.lang.Exception - if there is a problem while reading the filepublic static PMMLModel getPMMLModel(java.io.InputStream stream, Logger log) throws java.lang.Exception
stream - the InputStream to read fromlog - the logging object to use (or null if none is to be used)java.lang.Exception - if there is a problem while reading from the streamprotected static weka.core.pmml.TransformationDictionary getTransformationDictionary(org.w3c.dom.Document doc,
Instances dataDictionary)
throws java.lang.Exception
doc - the Document containing the PMML modeldataDictionary - the data dictionary as an Instances objectjava.lang.Exception - if there is a problem getting the transformation
dictionarypublic static void serializePMMLModel(PMMLModel model, java.lang.String filename) throws java.lang.Exception
PMMLModel object that encapsulates a PMML modelmodel - the PMMLModel to serializefilename - the name of the file to save tojava.lang.Exception - if something goes wrong during serializationpublic static void serializePMMLModel(PMMLModel model, java.io.File file) throws java.lang.Exception
PMMLModel object that encapsulates a PMML modelmodel - the PMMLModel to serializefile - the File to save tojava.lang.Exception - if something goes wrong during serializationpublic static void serializePMMLModel(PMMLModel model, java.io.OutputStream stream) throws java.lang.Exception
PMMLModel object that encapsulates a PMML modelmodel - the PMMLModel to serializestream - the OutputStream to serialize tojava.lang.Exception - if something goes wrong during serializationprotected static PMMLModel getModelInstance(org.w3c.dom.Document doc, PMMLFactory.ModelType modelType, org.w3c.dom.Element model, Instances dataDictionary, MiningSchema miningSchema) throws java.lang.Exception
doc - the Document holding the pmmlmodelType - the type of modelmodel - the Element encapsulating the model part of the DocumentdataDictionary - the data dictionary as an Instances objectminingSchema - the mining schemajava.lang.Exception - if there is a problem constructing the model or if the
model type is not supportedprotected static PMMLFactory.ModelType getModelType(org.w3c.dom.Document doc)
doc - the Document encapsulating the pmmlprotected static org.w3c.dom.Element getModelElement(org.w3c.dom.Document doc,
PMMLFactory.ModelType modelType)
throws java.lang.Exception
doc - the Document encapsulating the pmmlmodelType - the type of modeljava.lang.Exception - if the model type is unsupported/unknown@Deprecated protected static Instances getMiningSchemaAsInstances(org.w3c.dom.Element model, Instances dataDictionary) throws java.lang.Exception
model - the Element containing the pmml modeldataDictionary - the data dictionary as an Instances objectjava.lang.Exception - if something goes wrong during reading the mining schemaprotected static Instances getDataDictionaryAsInstances(org.w3c.dom.Document doc) throws java.lang.Exception
doc - the Document encapsulating the pmmljava.lang.Exception - if there are fields that are not continuous, ordinal or
categorical in the data dictionarypublic static java.lang.String applyClassifier(PMMLModel model, Instances test) throws java.lang.Exception
java.lang.Exceptionpublic static void main(java.lang.String[] args)