All Implemented Interfaces:
LogicalOperator

public final class DecisionTreePredictor extends AbstractPredictor
Operator responsible for predicting outcomes based on a Decision Tree PMML model. Supports most of the functionality listed here. That is, a subset of the PMML specification, but a superset of the functionality required for C4.5. Specifically, supports all required elements/attributes as well as the following optional elements/attributes:
  1. missingValueStategy ( all strategies supported )
  2. missingValuePenalty
  3. noTrueChildStategy ( all strategies supported )
  4. All predicates: SimplePredicate, CompoundPredicate, SimpleSetPredicate, True, False
  5. ScoreDistribution
Ignores the following elements/attributes:
  1. EmbeddedModel
  2. Partition
  3. ModelStats
  4. ModelExplanation
  5. Targets
  6. LocalTransformations
  7. ModelVerification
  8. splitCharacteristic
  • Constructor Details

    • DecisionTreePredictor

      public DecisionTreePredictor()
      Creates a decision tree predictor with default settings.
  • Method Details

    • getOutput

      public RecordPort getOutput()
      Returns a record port consisting of the original input plus predicted values. This adds the following additional fields.
      1. winner: The predicted value. Generally corresponds to the target with the highest record count; although PMML may specify an alternative winner via the "score" attribute. The name "winner" is the default; this is configurable via the property winnerField.
      2. record_count_targetValue (optional): The record count of the named targetValue. The prefix "record_count_" is the default; this is configurable via the property recordCountPrefix.
      3. confidence_targetValue (optional): The probability of the named targetValue. The prefix "confidence_" is the default; this is configurable via the property confidencePrefix.
        Overrides:
        getOutput in class AbstractPredictor
        Returns:
        a record flow of predicted values and their record counts
      4. isAppendRecordCount

        public boolean isAppendRecordCount()
        Returns whether to append record count information. This is false by-default.
        Returns:
        whether to append record count information.
      5. setAppendRecordCount

        public void setAppendRecordCount(boolean appendRecordCount)
        Sets whether to append record count information. This is false by-default.
        Parameters:
        appendRecordCount - whether to append record count information.
      6. getWinnerField

        public String getWinnerField()
        Gets the name of the winner field to output. This is "winner" by-default.
        Returns:
        the name of the winner field to output.
      7. setWinnerField

        public void setWinnerField(String winnerField)
        Sets the name of the winner field to output. This is "winner" by-default.
        Parameters:
        winnerField - the name of the winner field to output.
      8. getRecordCountPrefix

        public String getRecordCountPrefix()
        Gets the field name prefix to use for record counts. This is "record_count_" by-default.
        Returns:
        the field name prefix to use for record counts.
      9. setRecordCountPrefix

        public void setRecordCountPrefix(String recordCountPrefix)
        Sets the field name prefix to use for record counts. This is "record_count_" by-default.
        Parameters:
        recordCountPrefix - the field name prefix to use for record counts.
      10. getConfidencePrefix

        public String getConfidencePrefix()
        Gets the field name prefix to use for confidence. This is "confidence_" by-default.
        Returns:
        the field name prefix to use for confidence.
      11. setConfidencePrefix

        public void setConfidencePrefix(String confidencePrefix)
        Sets the field name prefix to use for confidence. This is "confidence_" by-default.
        Parameters:
        confidencePrefix - the field name prefix to use for confidence.
      12. isAppendConfidence

        public boolean isAppendConfidence()
        Returns whether to append confidence information. This is false by-default.
        Returns:
        whether to append confidence information.
      13. setAppendConfidence

        public void setAppendConfidence(boolean appendConfidence)
        Sets whether to append confidence information. This is false by-default.
        Parameters:
        appendConfidence - whether to append confidence information.
      14. predictedType

        protected RecordTokenType predictedType(PMMLModelSpec modelSpec)
        Description copied from class: AbstractPredictor
        Given the model spec, returns the predicted type. This should not include the input type ( the input is automatically prepended to the type that is returned )
        Specified by:
        predictedType in class AbstractPredictor
        Parameters:
        modelSpec - the model metadata
        Returns:
        the predicted type
      15. execute

        protected void execute(PMMLModel pmml, RecordValued input, ScalarSettable[] predictedFields)
        Description copied from class: AbstractPredictor
        Called to perform prediction. Subclasses are expected to loop over the input by calling AbstractPredictor.stepNext(). For each row of input, subclasses should first set the predicted values in the predictedFields array and then invoke AbstractPredictor.pushPrediction(). Subclasses should not invoke pushEndOfData since that is automatically handled by the base class.
        Specified by:
        execute in class AbstractPredictor
        Parameters:
        pmml - The input PMML model
        input - The input data
        predictedFields - An array of fields that reference the predicted field locations. The array positionally corresponds to the type returned by AbstractPredictor.predictedType(PMMLModelSpec).