DARTClassifier<T>
Models & Types · AiDotNet.Classification.Boosting
DART (Dropouts meet Multiple Additive Regression Trees) classifier.
Inheritance: ClassifierBase<T> → ProbabilisticClassifierBase<T> → EnsembleClassifierBase<T> → DARTClassifier<T>
For Beginners
DART is like gradient boosting classifier with a twist - it randomly “forgets” some of its trees when learning new ones. This prevents the model from becoming too specialized and helps it work better on new data.
Key concepts:
- Dropout: Randomly removing trees during training (like dropout in neural networks)
- Normalization: Adjusting predictions after dropout to maintain correct scale
- Ensemble: The final prediction uses all trees (no dropout at prediction time)
When to use DART over regular gradient boosting:
- Your model overfits (training error low, validation error high)
- You want more robust predictions
- You have enough time (DART is slower than regular boosting)
How It Works
DART applies dropout regularization to gradient boosting for classification. During each iteration, a random subset of existing trees is dropped, and the new tree is fitted to residuals computed only from the non-dropped trees. This prevents overfitting.
Reference: Rashmi, K.V. & Gilad-Bachrach, R. (2015). “DART: Dropouts meet Multiple Additive Regression Trees”. AISTATS 2015.
Example
// Create DART classifier with dropout regularization for gradient boosting
var options = new DARTClassifierOptions<double>();
// Prepare training data
var features = new Matrix<double>(new double[,] { { 1.0, 1.1 }, { 1.2, 0.9 }, { 0.8, 1.0 }, { 5.0, 5.1 }, { 5.2, 4.9 }, { 4.8, 5.0 } });
var labels = new Vector<double>(new double[] { 0, 0, 0, 1, 1, 1 });
// Train with dropout applied to tree ensemble during boosting
var result = new AiModelBuilder<double, Matrix<double>, Vector<double>>()
.ConfigureModel(new DARTClassifier<double>(options))
.Build(features, labels);
// Predict using all trees (no dropout at inference)
var newSample = new Matrix<double>(new double[,] { { 1.1, 1.0 } });
var prediction = result.Predict(newSample);
// Result is available in the returned value
Constructors
| Constructor | Summary |
|---|---|
DARTClassifier(DARTClassifierOptions<T> options, IRegularization<T, Matrix<T>, Vector<T>> regularization) |
Initializes a new instance of DART classifier. |
Properties
| Property | Summary |
|---|---|
int NumberOfTrees { get; } |
Gets the number of trees in the ensemble. |
Methods
| Method | Summary |
|---|---|
Matrix<T> PredictProbabilities(Matrix<T> input) |
Predicts class probabilities for input samples. |
ModelMetadata<T> GetModelMetadata() |
|
Vector<T> Predict(Matrix<T> input) |
Predicts class labels for input samples. |
void Train(Matrix<T> x, Vector<T> y) |
Returns the model type identifier for this classifier. |