Documentation of 'jsat.classifiers.trees.DecisionTree' Java class
DecisionTree
jsat.classifiers.trees

Class DecisionTree

    • Constructor Detail

      • DecisionTree

        public DecisionTree(int maxDepth)
        Creates a Decision Tree that does not do any pruning, and is built out only to the specified depth
        Parameters:
        maxDepth -
      • DecisionTree

        public DecisionTree(int maxDepth,
                            int minSamples,
                            TreePruner.PruningMethod pruningMethod,
                            double testProportion)
        Creates a new decision tree classifier
        Parameters:
        maxDepth - the maximum depth of the tree to create
        minSamples - the minimum number of samples needed to continue branching
        pruningMethod - the method of pruning to use after construction
        testProportion - the proportion of the data set to put aside to use for pruning
    • Method Detail

      • train

        public void train(RegressionDataSet dataSet,
                          java.util.Set<java.lang.Integer> options)
      • train

        public void train(RegressionDataSet dataSet,
                          java.util.Set<java.lang.Integer> options,
                          boolean parallel)
      • getC45Tree

        public static DecisionTree getC45Tree()
        Returns a Decision Tree with settings initialized so that its behavior is approximately that of the C4.5 decision tree algorithm when used on classification data. The exact behavior not identical, and certain base cases may not behave in the exact same manner. However, it uses all of the same general algorithms.

        The returned tree does not perform or support
        • discrete attribute grouping
        • windowing
        • subsidiary cutpoints (soft boundaries)
        Returns:
        a decision tree that will behave in a manner similar to C4.5
      • setMinResultSplitSize

        public void setMinResultSplitSize(int size)
        When a split is made, it may be that outliers cause the split to segregate a minority of points from the majority. The min result split size parameter specifies the minimum allowable number of points to end up in one of the splits for it to be admisible for consideration.
        Parameters:
        size - the minimum result split size to use
      • getMinResultSplitSize

        public int getMinResultSplitSize()
        Returns the minimum result split size that may be considered for use as the attribute to split on.
        Returns:
        the minimum result split size in use
      • setMaxDepth

        public void setMaxDepth(int maxDepth)
        Sets the maximum depth that this classifier may build trees to.
        Parameters:
        maxDepth - the maximum depth of the trained tree
      • getMaxDepth

        public int getMaxDepth()
        The maximum depth that this classifier may build trees to.
        Returns:
        the maximum depth that this classifier may build trees to.
      • setMinSamples

        public void setMinSamples(int minSamples)
        Sets the minimum number of samples needed at each step in order to continue branching
        Parameters:
        minSamples - the minimum number of samples needed to branch
      • getMinSamples

        public int getMinSamples()
        The minimum number of samples needed at each step in order to continue branching
        Returns:
        the minimum number of samples needed at each step in order to continue branching
      • setPruningMethod

        public void setPruningMethod(TreePruner.PruningMethod pruningMethod)
        Sets the method of pruning that will be used after tree construction
        Parameters:
        pruningMethod - the method of pruning that will be used after tree construction
        See Also:
        TreePruner.PruningMethod
      • getPruningMethod

        public TreePruner.PruningMethod getPruningMethod()
        Returns the method of pruning used after tree construction
        Returns:
        the method of pruning used after tree construction
      • getTestProportion

        public double getTestProportion()
        Returns the proportion of the training set that is put aside to perform pruning with
        Returns:
        the proportion of the training set that is put aside to perform pruning with
      • setTestProportion

        public void setTestProportion(double testProportion)
        Sets the proportion of the training set that is put aside to perform pruning with.
        NOTE: The values 0 and 1 are special cases.
        0 indicates that no pruning will occur regardless of the set pruning method
        1 indicates that the training set will be used as the testing set. This is valid for some pruning methods.
        Parameters:
        testProportion - the proportion, must be in the range [0, 1]
      • classify

        public CategoricalResults classify(DataPoint data)
        Description copied from interface: Classifier
        Performs classification on the given data point.
        Specified by:
        classify in interface Classifier
        Parameters:
        data - the data point to classify
        Returns:
        the results of the classification.
      • train

        public void train(ClassificationDataSet dataSet,
                          boolean parallel)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
        parallel - true if multiple threads should be used to train the model. false if it should be done in a single threaded manner.
      • supportsWeightedData

        public boolean supportsWeightedData()
        Description copied from interface: Classifier
        Indicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.
        Specified by:
        supportsWeightedData in interface Classifier
        Specified by:
        supportsWeightedData in interface Regressor
        Returns:
        true if the model supports weighted data, false otherwise
      • getTreeNodeVisitor

        public TreeNodeVisitor getTreeNodeVisitor()
        Description copied from interface: TreeLearner
        Obtains a node visitor for the tree learner that can be used to traverse and predict from the learned tree
        Specified by:
        getTreeNodeVisitor in interface TreeLearner
        Returns:
        the root node visitor for the learned tree
      • getParameters

        public java.util.List<Parameter> getParameters()
        Description copied from interface: Parameterized
        Returns the list of parameters that can be altered for this learner.
        Specified by:
        getParameters in interface Parameterized
        Returns:
        the list of parameters that can be altered for this learner.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.