cursus.steps.configs.config_tsa_model_calibration_step

TSA Model Calibration Step Configuration with Self-Contained Derivation Logic

This module implements the configuration class for the TSAModelCalibration 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)

class TSAModelCalibrationConfig(*, author, bucket, role, region, service_name, pipeline_version, model_class='xgboost', current_date=<factory>, framework_version='2.1.0', 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.m5.4xlarge', processing_instance_type_small='ml.m5.2xlarge', use_large_processing_instance=False, skip_volume_kms=None, processing_source_dir='afn_return_kickout/dockers/scripts', processing_entry_point='tsa_model_calibration.py', processing_script_arguments=None, processing_framework_version='1.2-1', label_field, score_field, calibration_method='bspline', bspline_degree=3, adaptive_knots=True, base_knots=None, min_records=1000, min_fraud=10, max_coef_threshold=1000000000000.0, min_unique_values=10, lambda_smooth=1e-10, max_iter=1000, tolerance=1e-06, job_type='calibration', **extra_data)[source]

Bases: ProcessingStepConfigBase

Configuration for TSAModelCalibration step with self-contained derivation logic.

This class defines the configuration parameters for the TSAModelCalibration step, which uses monotone B-spline calibration to convert raw TSA model prediction scores into well-calibrated probabilities for fraud detection. The calibration method is specifically designed for Temporal Self-Attention models with emphasis on high-score regions important for fraud detection.

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)

label_field: str
score_field: str
calibration_method: str
bspline_degree: int
adaptive_knots: bool
base_knots: int | None
min_records: int
min_fraud: int
max_coef_threshold: float
min_unique_values: int
lambda_smooth: float
max_iter: int
tolerance: float
job_type: str
processing_entry_point: str
processing_source_dir: str
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].

initialize_derived_fields()[source]

Initialize all derived fields once after validation.

validate_config()[source]

Validate configuration and ensure defaults are set.

Returns:

The validated configuration object

Return type:

Self

Raises:

ValueError – If any validation fails

get_environment_variables()[source]

Get environment variables for the TSA calibration processing script.

Returns:

Dictionary of environment variables to be passed to the processing script.

Return type:

dict

get_public_init_fields()[source]

Override get_public_init_fields to include TSA calibration-specific fields. Gets a dictionary of public fields suitable for initializing a child config. Includes both base fields (from parent) and TSA calibration-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.