cursus.steps.configs.config_tsa_model_eval_step

TSA Model Evaluation Step Configuration with Self-Contained Derivation Logic

This module implements the configuration class for the TSA model evaluation step using a self-contained design where derived fields are private with read-only properties. 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 with properties)

Aligned with PyTorch model eval config structure.

class TSAModelEvalConfig(*, author, bucket, role, region, service_name, pipeline_version, model_class='xgboost', current_date=<factory>, framework_version='2.1.2', py_version='py310', source_dir=None, enable_caching=False, use_secure_pypi=False, max_runtime_seconds=172800, project_root_folder, processing_instance_count=1, processing_volume_size=500, processing_instance_type_large='ml.p3.16xlarge', processing_instance_type_small='ml.g5.16xlarge', use_large_processing_instance=True, skip_volume_kms=None, processing_source_dir=None, processing_entry_point='tsa_model_eval.py', processing_script_arguments=None, processing_framework_version='1.2-1', id_name='objectId', label_name='is_abusive_mdr', task2_label_name='is_abusive_flr', job_type='evaluation', data_version='v0', enable_eval_streaming=False, enable_amp=True, num_workers=4, enable_cpu_optimization=True, eval_percentile=0.99, eval_batch_size=None, **extra_data)[source]

Bases: ProcessingStepConfigBase

Configuration for TSA model evaluation step with self-contained derivation logic.

This class defines the configuration parameters for the TSA (Temporal Self-Attention) model evaluation step, which calculates evaluation metrics for trained PyTorch models with dual-task learning support. Computes comprehensive metrics including AUC-ROC, precision-recall, dollar-weighted metrics, and generates visualizations.

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 with properties)

id_name: str
label_name: str
task2_label_name: str
processing_entry_point: str
job_type: str
data_version: str
framework_version: str
py_version: str
processing_instance_type_large: str
processing_instance_type_small: str
use_large_processing_instance: bool
enable_eval_streaming: bool
enable_amp: bool
num_workers: int
enable_cpu_optimization: bool
eval_percentile: float
eval_batch_size: int | None
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

validate_and_initialize()[source]

Single unified validator that handles initialization, defaults, and validation.

Combining all validators ensures proper execution order: 1. Initialize derived fields (parent) 2. Set eval_batch_size defaults 3. Validate TSA-specific requirements

classmethod validate_instance_type_flexible(v)[source]

Validate instance type supports PyTorch (GPU or CPU).

classmethod validate_job_type(v)[source]

Validate job_type is a valid value.

get_environment_variables()[source]

Get environment variables for the TSA model evaluation script.

Returns:

Dictionary mapping environment variable names to values

Return type:

Dict[str, str]

get_public_init_fields()[source]

Override get_public_init_fields to include TSA evaluation-specific fields. Gets a dictionary of public fields suitable for initializing a child config. Includes both base fields (from parent) and evaluation-specific fields.

Returns:

Dictionary of field names to values for child initialization

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.