NodeShape<T, TNode>
Models & Types · AiDotNet.Models
Describes ONE node of a recursive structure, so the registry can walk the whole of it.
How It Works
A decision tree, a Hoeffding tree, an M5 model tree – their learned model is a node graph, not a vector, and it was the one shape nothing here could express. Every tree model therefore kept a hand-written Serialize that walked the graph itself, and every ENSEMBLE of trees inherited that: a forest cannot round-trip until its members can.
The model describes a single node – its own fields, and which of its members are children – and the registry does the recursion, the null markers and the ordering. Nothing in the model touches a reader or a writer, and the description is small enough to read at a glance.
Constructors
| Constructor | Summary |
|---|---|
NodeShape() |
Methods
| Method | Summary |
|---|---|
NodeShape<T, TNode> Boolean(Func<TNode, bool> get, Action<TNode, bool> set) |
Declares a boolean field on the node. |
NodeShape<T, TNode> Child(Func<TNode, TNode> get, Action<TNode, TNode> set) |
Declares one of the node’s children. |
NodeShape<T, TNode> Create(Func<TNode> factory) |
Declares how to make an empty node. |
NodeShape<T, TNode> Double(Func<TNode, double> get, Action<TNode, double> set) |
Declares a Double field on the node. |
NodeShape<T, TNode> DoubleArray(Func<TNode, double[]> get, Action<TNode, double[]> set) |
Declares a Double array field on the node, such as a leaf’s curve. |
NodeShape<T, TNode> Int32(Func<TNode, int> get, Action<TNode, int> set) |
Declares an integer field on the node. |
NodeShape<T, TNode> Int64(Func<TNode, long> get, Action<TNode, long> set) |
Declares a 64-bit integer field on the node. |
NodeShape<T, TNode> Scalar(Func<TNode, T> get, Action<TNode, T> set) |
Declares a field held as the model’s numeric type. |
NodeShape<T, TNode> Vector(Func<TNode, Vector<T>> get, Action<TNode, Vector<T>> set) |
Declares a vector field on the node, such as class probabilities. |