CrossSectionalGraphModelBase<T>
Base Classes · AiDotNet.Finance.Base
Base class for financial models that operate on a CROSS-SECTION of assets connected by a graph, and that predict more than one quantity per asset.
Inheritance: NeuralNetworkBase<T> → FinancialModelBase<T> → CrossSectionalGraphModelBase<T>
Known derived types: Stockformer<T>
For Beginners
Some financial models look at many stocks at once and let related stocks inform each other, instead of treating each in isolation. This is the shared foundation for those, including the part where they answer more than one question at a time.
How It Works
Two things separate these models from the rest of FinancialModelBase, and neither
fits the single-tensor Predict contract:
Why a base class rather than folding this into FinancialModelBase. Most financial models
here have neither property, and widening the common base for a minority would put an unused
Adjacency on every regression and forecasting model in the library. More than one model
needs this shape — Stockformer today, and
graph-attention portfolio construction next — which is what justifies the abstraction rather than
a one-off.
What this deliberately does NOT do: implement IFactorModel. That interface requires
ExtractFactors, GetFactorLoadings, GetFactorCovariance and ComputeAlpha
— latent-factor semantics. A cross-sectional graph forecaster has no factor decomposition, and
supplying degenerate values so the interface can be claimed would misrepresent the model. Models
that genuinely are factor models keep implementing it directly.
Properties
| Property | Summary |
|---|---|
IReadOnlyList<string> TaskNames { get; } |
Gets the name of each prediction head, in the order PredictAllTasks returns them. |
Matrix<T> AssetEmbedding { get; set; } |
Gets or sets a precomputed per-asset structural EMBEDDING, [assets, embeddingWidth]. |
Matrix<T> AssetGraph { get; set; } |
Gets or sets the asset relationship TOPOLOGY, [assets, assets]. |
bool HasEmbedding { get; } |
Whether a precomputed structural EMBEDDING has been supplied. |
bool HasGraph { get; } |
Whether asset TOPOLOGY has been supplied. |
int TaskCount { get; } |
Gets the number of prediction heads this model exposes. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<Tensor<T>> PredictAllTasks(Tensor<T> input) |
Runs every prediction head over the cross-section. |