ObliviousDecisionTreeLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Oblivious Decision Tree (ODT) for NODE architecture.

Inheritance: LayerBase<T> → ObliviousDecisionTreeLayer<T>

Implements: IShapeContract

For Beginners

An oblivious tree is a special type of decision tree where:

  • At level 1, ALL nodes use the same feature (e.g., “age > 30”)
  • At level 2, ALL nodes use the same feature (e.g., “income > 50k”)
  • And so on…

This is simpler than regular trees where each node can use different features. The simplicity helps prevent overfitting and makes the tree faster.

How It Works

An oblivious decision tree uses the same feature and threshold at each level, making it more regularized and efficient than standard decision trees. NODE uses differentiable ODTs with entmax splits for end-to-end learning.

Constructors

Constructor Summary
ObliviousDecisionTreeLayer(int depth, int outputDim, double initScale) Lazy constructor: resolves inputDim from input.Shape[^1] on first Forward.
ObliviousDecisionTreeLayer(int depth, int outputDim, double initScale, ObliviousTreeChoiceFunction choiceFunction) Lazy constructor with explicit choice functions: resolves inputDim from input.Shape[^1] on first Forward.
ObliviousDecisionTreeLayer(int inputDim, int depth, int outputDim, double initScale) Lazy constructor with explicit choice functions: resolves inputDim from input.Shape[^1] on first Forward.
ObliviousDecisionTreeLayer(int inputDim, int depth, int outputDim, double initScale, ObliviousTreeChoiceFunction choiceFunction) Initializes an oblivious decision tree with explicit choice functions.

Properties

Property Summary
bool SupportsTraining { get; }
int NumLeaves { get; } Gets the number of leaf nodes (2^depth).

Methods

Method Summary
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
Vector<T> GetFeatureImportance() Gets feature importance based on selection weights.
void ResetState()
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate)
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).