AsyncDecisionTreeRegressionBase<T>

Base Classes · AiDotNet.Regression

Represents an abstract base class for asynchronous decision tree regression models.

Implements: IAsyncTreeBasedModel<T>, IModelShape

Known derived types: AdaBoostR2Regression<T>, BetaRegression<T>, ConditionalInferenceTreeRegression<T>, DARTRegression<T>, DeepHit<T>, DeepSurv<T>, ExplainableBoostingMachineRegression<T>, ExtremelyRandomizedTreesRegression<T>, GAMLSSRegression<T>, GradientBoostingRegression<T>, M5ModelTree<T>, NGBoostRegression<T>, QuantileRegressionForests<T>, RandomForestRegression<T>, ZeroInflatedRegression<T>

For Beginners

A decision tree is a type of machine learning model that makes predictions by following a series of yes/no questions about the input data. It’s like a flowchart that helps the computer decide what prediction to make.

For example, if you’re trying to predict if it will rain:

  • Is the humidity high? If yes, go to next question. If no, predict no rain.
  • Are there clouds? If yes, predict rain. If no, predict no rain.

This class provides the basic structure for building these types of models, but with more complex questions and answers based on numerical data.

How It Works

This class provides a foundation for implementing decision tree regression models that can be trained and used for predictions asynchronously. It includes methods for training, prediction, serialization, and deserialization of the model.

Properties

Property Summary
ILossFunction<T> DefaultLossFunction { get; }
T SoftTreeTemperature { get; set; } Gets or sets the temperature parameter for soft decision tree mode.
Vector<T> FeatureImportances { get; set; } Gets or sets the importance of each feature in making predictions.
bool SupportsParameterInitialization { get; }
bool UseSoftTree { get; set; } Gets or sets whether to use soft (differentiable) tree mode for JIT compilation support.
int MaxDepth { get; } Gets the maximum depth of the decision tree.
int NumberOfTrees { get; } Gets the number of trees in the model.
long ParameterCount { get; }
string[] FeatureNames { get; set; } Gets or sets the feature names.

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance() Gets the feature importance scores as a dictionary.
DynamicShapeInfo GetDynamicShapeInfo()
IEnumerable<int> GetActiveFeatureIndices() Gets the indices of all features that are used in the decision tree.
IFullModel<T, Matrix<T>, Vector<T>> Clone() Creates a clone of the decision tree model.
IFullModel<T, Matrix<T>, Vector<T>> DeepCopy() Creates a deep copy of the decision tree model.
IFullModel<T, Matrix<T>, Vector<T>> WithParameters(Vector<T> parameters)
ModelMetadata<T> GetModelMetadata() Gets metadata about the trained model.
ModelOptions GetOptions()
Task TrainAsync(Matrix<T> x, Vector<T> y) Asynchronously trains the decision tree model on the provided data.
Task<Vector<T>> PredictAsync(Matrix<T> input) Asynchronously makes predictions using the trained model.
Vector<T> ComputeGradients(Matrix<T> input, Vector<T> target, ILossFunction<T> lossFunction)
Vector<T> GetParameters() Gets the model parameters as a vector representation.
Vector<T> Predict(Matrix<T> input) Makes predictions using the trained model.
Vector<T> SanitizeParameters(Vector<T> parameters)
bool IsFeatureUsed(int featureIndex) Determines whether a specific feature is used in the decision tree.
byte[] Serialize() Serializes the model to a byte array.
int[] GetInputShape() Saves the model to a file.
int[] GetOutputShape()
void ApplyGradients(Vector<T> gradients, T learningRate)
void Deserialize(byte[] modelData) Deserializes the model from a byte array.
void Dispose()
void LoadModel(string filePath) Loads the model from a file.
void LoadState(Stream stream) Loads the model’s state from a stream.
void SaveModel(string filePath)
void SaveState(Stream stream) Saves the model’s current state to a stream.
void SetParameters(Vector<T> parameters) Creates a new instance of the model with the specified parameters.
void Train(Matrix<T> x, Vector<T> y) Trains the decision tree model on the provided data.