CSDI<T>
Models & Types · AiDotNet.Finance.Forecasting.Foundation
CSDI — Conditional Score-based Diffusion Model for Probabilistic Time Series Imputation.
Inheritance: NeuralNetworkBase<T> → FinancialModelBase<T> → ForecastingModelBase<T> → TimeSeriesFoundationModelBase<T> → CSDI<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
CSDI fills in missing data points in time series and forecasts future values using a diffusion process. Think of it like an artist restoring a damaged painting: it looks at the intact parts and intelligently fills in the gaps. Unlike simpler methods that fill one gap at a time, CSDI fills all missing values simultaneously, which produces more consistent and realistic results.
How It Works
CSDI uses score-based diffusion for non-autoregressive time series imputation and forecasting. It conditions on observed values using a transformer-based denoiser and generates all missing values simultaneously.
Reference: Tashiro et al., “CSDI: Conditional Score-based Diffusion Models for Probabilistic Time Series Imputation”, NeurIPS 2021.
Example
// Create a CSDI conditional score-based diffusion model for time series imputation
// Uses score-matching for probabilistic forecasting and missing value imputation
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputHeight: 512, inputWidth: 1, inputDepth: 1, outputSize: 24);
// Training mode with conditional score-based diffusion
var model = new CSDI<double>(architecture);
// ONNX inference mode with pre-trained model
var onnxModel = new CSDI<double>(architecture, "csdi.onnx");
Constructors
| Constructor | Summary |
|---|---|
CSDI(NeuralNetworkArchitecture<T> architecture, CSDIOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
|
CSDI(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, CSDIOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Properties
| Property | Summary |
|---|---|
FoundationModelSize ModelSize { get; } |
|
bool IsChannelIndependent { get; } |
|
bool SupportsTraining { get; } |
|
bool UseNativeMode { get; } |
|
int MaxContextLength { get; } |
|
int MaxPredictionHorizon { get; } |
|
int NumFeatures { get; } |
|
int PatchSize { get; } |
|
int PredictionHorizon { get; } |
|
int SequenceLength { get; } |
|
int Stride { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> Evaluate(Tensor<T> predictions, Tensor<T> actuals) |
|
Dictionary<string, T> GetFinancialMetrics() |
|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> ApplyInstanceNormalization(Tensor<T> input) |
|
Tensor<T> AutoregressiveForecast(Tensor<T> input, int steps) |