DecisionTreeClassifier class abstract

A class that performs decision tree-based classification


DecisionTreeClassifier(DataFrame trainData, String targetName, {num minError = 0.5, int minSamplesCount = 1, int maxDepth = 10, DType dtype = dTypeDefaultValue, TreeAssessorType assessorType = TreeAssessorType.gini})
DecisionTreeClassifier.fromJson(String json)
Restores previously fitted classifier instance from the given json


assessorType TreeAssessorType
An assessment type that was applied to the initial data in order to decide how to split it while building the tree
no setter
dtype DType
A type for all numeric values using by the Predictor
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
maxDepth int
A maximum number of decision tree levels.
no setter
minError num
A minimal error on a single decision tree node. It is used as a stop criteria to avoid further decision tree node splitting: if the node is good enough, there is no need to split it and thus it can be considered a leaf.
no setter
minSamplesCount int
A minimal number of samples (observations) on the decision's tree node. The value is used as a stop criteria to avoid further decision tree node splitting: if the node contains less than or equal to minSamplesCount observations, the node is considered a leaf.
no setter
negativeLabel num
A value using to encode negative class.
no setterinherited
positiveLabel num
A value using to encode positive class.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemaVersion int?
Contains a version of the current json schema
no setterinherited
targetNames Iterable<String>
A collection of target column names of a dataset which was used to learn the ML model
no setterinherited


assess(DataFrame observations, MetricType metricType) double
Assesses model performance according to provided metricType
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
predict(DataFrame testFeatures) → DataFrame
Returns prediction, based on the learned coefficients
predictProbabilities(DataFrame testFeatures) → DataFrame
Returns predicted distribution of probabilities for each observation in the passed testFeatures
retrain(DataFrame data) DecisionTreeClassifier
Re-runs the learning process on the new training data. The features, model algorithm, and hyperparameters remain the same.
saveAsJson(String filePath) Future<File>
Saves a json-serializable map into a newly created file with the path filePath
saveAsSvg(String filePath) Future<File>
Saves the tree as an SVG-image. Example:
toJson() Map<String, dynamic>
Returns a json-serializable map
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.