cursus.steps.hyperparams.hyperparameters_tsa¶
- class TemporalSelfAttentionHyperparameters(*, full_field_list, cat_field_list, tab_field_list, id_name, label_name, multiclass_categories, categorical_features_to_encode=<factory>, model_class='temporal_self_attention', device=-1, header=0, lr=3e-05, batch_size=2, eval_batch_size_multiplier=2.0, max_epochs=3, metric_choices=['f1_score', 'auroc'], optimizer='SGD', class_weights=None, n_embedding, n_cat_features, n_num_features, seq_len, seq_cat_key='x_seq_cat', seq_num_key='x_seq_num', seq_time_key='time_seq', engineered_key='x_engineered', dim_embedding_table=128, dim_attn_feedforward=512, num_heads=8, n_layers_order=2, n_layers_feature=2, dropout=0.1, use_moe=False, num_experts=4, expert_capacity_factor=1.25, expert_dropout=0.1, use_time_seq=True, time_encoding_dim=32, return_seq=False, use_key_padding_mask=True, loss='CrossEntropyLoss', loss_alpha=0.25, loss_gamma=2.0, loss_gamma_min=1.0, loss_gamma_max=3.0, loss_cycle_length=1000, loss_reduction='mean', weight_decay=0.0, adam_epsilon=1e-08, warmup_steps=300, run_scheduler=True)[source]¶
Bases:
ModelHyperparametersHyperparameters for Temporal Self-Attention (TSA) model training, extending the base ModelHyperparameters.
Fields are organized into three tiers: 1. Tier 1: Essential User Inputs - fields that users must explicitly provide 2. Tier 2: System Inputs with Defaults - fields with reasonable defaults that can be overridden 3. Tier 3: Derived Fields - fields calculated from other fields (private attributes with properties)
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'protected_namespaces': (), 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property model_config_dict: Dict[str, Any]¶
Get complete model configuration dictionary derived from hyperparameters.
- validate_tsa_hyperparameters()[source]¶
Validate TSA-specific hyperparameters and initialize derived fields.
- get_public_init_fields()[source]¶
Override get_public_init_fields to include TSA-specific derived fields. Gets a dictionary of public fields suitable for initializing a child config.
- get_trainer_config()[source]¶
Get trainer configuration dictionary for PyTorch Lightning. This combines various trainer-related settings.
- Returns:
Configuration dictionary for trainer
- Return type:
Dict[str, Any]
- model_post_init(context, /)¶
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.