Documentation
¶
Overview ¶
Experimental — this package is not yet wired into the main framework.
Package crossasset provides a cross-attention model for multi-source feature processing. Each source attends to features of all other sources via scaled dot-product multi-head attention, enabling the model to learn inter-source dependencies. This is useful for scenarios where multiple correlated data sources (e.g., different financial instruments or sensor streams) must be jointly analyzed.
The model architecture applies cross-attention layers where each source computes queries from its own features and keys/values from all sources' features. Layer normalization and residual connections stabilize training.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
NSources int
FeaturesPerSource int
DModel int
NHeads int
NLayers int
DropoutRate float64
LearningRate float64
}
Config holds the configuration for a cross-asset attention model.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model implements a cross-attention model for multi-source features.
func (*Model) AttentionWeights ¶
AttentionWeights computes the attention weight matrix showing how much each source attends to each other source. Returns [n_sources][n_sources] where result[i][j] is how much source i attends to source j. Weights sum to 1 across the attended (j) dimension.
func (*Model) Forward ¶
Forward processes features through the cross-attention model. features shape: [n_sources][features_per_source]. Returns: [n_sources][d_model].
type TrainConfig ¶
TrainConfig holds training hyperparameters.