weka.classifiers.pmml.consumer
Class TreeModel

java.lang.Object
  extended by weka.classifiers.AbstractClassifier
      extended by weka.classifiers.pmml.consumer.PMMLClassifier
          extended by weka.classifiers.pmml.consumer.TreeModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Classifier, CapabilitiesHandler, Drawable, OptionHandler, PMMLModel, RevisionHandler

public class TreeModel
extends PMMLClassifier
implements Drawable

Class implementing import of PMML TreeModel. Can be used as a Weka classifier for prediction (buildClassifier() raises and Exception).

Version:
$Revision: 5987 $;
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
 
Constructor Summary
TreeModel(org.w3c.dom.Element model, Instances dataDictionary, MiningSchema miningSchema)
           
 
Method Summary
 double[] distributionForInstance(Instance inst)
          Classifies the given test instance.
 java.lang.String getRevision()
          Returns the revision string.
 java.lang.String graph()
          Returns a string that describes a graph representing the object.
 int graphType()
          Returns the type of graph representing the object.
 java.lang.String toString()
           
 
Methods inherited from class weka.classifiers.pmml.consumer.PMMLClassifier
buildClassifier, done, getCreatorApplication, getDataDictionary, getFieldsMappingString, getLog, getMiningSchema, getPMMLVersion, mapToMiningSchema, setCreatorApplication, setLog, setPMMLVersion
 
Methods inherited from class weka.classifiers.AbstractClassifier
classifyInstance, debugTipText, forName, getCapabilities, getDebug, getOptions, listOptions, makeCopies, makeCopy, runClassifier, setDebug, setOptions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeModel

public TreeModel(org.w3c.dom.Element model,
                 Instances dataDictionary,
                 MiningSchema miningSchema)
          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

distributionForInstance

public double[] distributionForInstance(Instance inst)
                                 throws java.lang.Exception
Classifies the given test instance. The instance has to belong to a dataset when it's being classified.

Specified by:
distributionForInstance in interface Classifier
Overrides:
distributionForInstance in class AbstractClassifier
Parameters:
inst - the instance to be classified
Returns:
the predicted most likely class for the instance or Utils.missingValue() if no prediction is made
Throws:
java.lang.Exception - if an error occurred during the prediction

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

graph

public java.lang.String graph()
                       throws java.lang.Exception
Description copied from interface: Drawable
Returns a string that describes a graph representing the object. The string should be in XMLBIF ver. 0.3 format if the graph is a BayesNet, otherwise it should be in dotty format.

Specified by:
graph in interface Drawable
Returns:
the graph described by a string
Throws:
java.lang.Exception - if the graph can't be computed

getRevision

public java.lang.String getRevision()
Description copied from class: AbstractClassifier
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Overrides:
getRevision in class AbstractClassifier
Returns:
the revision

graphType

public int graphType()
Description copied from interface: Drawable
Returns the type of graph representing the object.

Specified by:
graphType in interface Drawable
Returns:
the type of graph representing the object