Class DecisionTreePredictor

  • 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 Detail

      • DecisionTreePredictor

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

      • 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
        • isAppendRecordCount

          public boolean isAppendRecordCount()
          Returns whether to append record count information. This is false by-default.
          Returns:
          whether to append record count information.
        • 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.
        • 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.
        • 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.
        • 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.
        • 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.
        • 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.
        • 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.
        • isAppendConfidence

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

          public void setAppendConfidence​(boolean appendConfidence)
          Sets whether to append confidence information. This is false by-default.
          Parameters:
          appendConfidence - whether to append confidence information.
        • 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