IFinancialModel<T>
Interfaces · AiDotNet.Finance.Interfaces
Base interface for all financial AI models in AiDotNet.Finance.
Implements: IFullModel<T, Tensor<T>, Tensor<T>>
Known implementations: FinancialModelBase<T>, IFactorModel<T>, IForecastingModel<T>, IPortfolioOptimizer<T>, IRiskModel<T>, IVolatilityModel<T>
For Beginners
Financial AI models in this library follow a dual-mode pattern:
- Native Mode: Uses pure C# neural network layers for training and inference.
This mode supports gradient computation, parameter updates, and full training capabilities. Use this when you need to train models from scratch or fine-tune on your data.
- ONNX Mode: Loads pretrained models in ONNX format for fast inference only.
This mode is optimized for production deployment where you don’t need training. Use this when deploying pretrained models for prediction.
All financial models share common capabilities:
- Time series forecasting
- Uncertainty quantification (prediction intervals)
- Financial metrics computation (Sharpe ratio, drawdown, etc.)
- Integration with the AiDotNet ecosystem (serialization, checkpointing, etc.)
How It Works
This interface extends IFullModel with financial-specific capabilities,
including support for both ONNX inference and native trainable implementations.
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Gets whether training is supported (only in native mode). |
bool UseNativeMode { get; } |
Gets whether this model uses native mode (true) or ONNX mode (false). |
int NumFeatures { get; } |
Gets the number of input features (variables) the model expects. |
int PredictionHorizon { get; } |
Gets the model’s prediction horizon (number of future time steps to forecast). |
int SequenceLength { get; } |
Gets the model’s expected input sequence length. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetFinancialMetrics() |
Gets financial-specific metrics from the model. |
Tensor<T> Forecast(Tensor<T> input, double[] quantiles) |
Generates forecasts with uncertainty quantification. |