cursus.steps.configs.config_tsa_preprocessing_step

TSA Data Preprocessing Configuration with Self-Contained Derivation Logic

This module implements the configuration class for SageMaker Processing steps for TSA (Temporal Self-Attention) data preprocessing, using a self-contained design where each field is properly categorized according to the three-tier design: 1. Essential User Inputs (Tier 1) - Required fields that must be provided by users 2. System Fields (Tier 2) - Fields with reasonable defaults that can be overridden 3. Derived Fields (Tier 3) - Fields calculated from other fields, private with read-only properties

class TSAPreprocessingConfig(*, 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.m5.4xlarge', processing_instance_type_small='ml.m5.2xlarge', use_large_processing_instance=False, skip_volume_kms=None, processing_source_dir=None, processing_entry_point='tsa_preprocessing.py', processing_script_arguments=None, processing_framework_version='1.2-1', job_type='training', tag='is_abusive_mdr', tag2='is_flr', target_positive_rate=0.2, time_window_train=240, time_window_calib=150, time_window_vali=90, amount_field='concamt', preprocessor_path=None, seq_len=51, data_version='v0', seed=0, enable_tsa_streaming=False, tsa_streaming_batch_size=10, validation_split_ratio=0.1, time_delta_cap=20736000, **extra_data)[source]

Bases: ProcessingStepConfigBase

Configuration for the TSA Preprocessing step with three-tier field categorization. Inherits from ProcessingStepConfigBase.

Fields are categorized into: - Tier 1: Essential User Inputs - Required from users - Tier 2: System Fields - Default values that can be overridden - Tier 3: Derived Fields - Private with read-only property access

job_type: str
processing_entry_point: str
py_version: str
framework_version: str
tag: str
tag2: str
target_positive_rate: float
time_window_train: int
time_window_calib: int
time_window_vali: int
amount_field: str
preprocessor_path: str | None
seq_len: int
data_version: str
seed: int
enable_tsa_streaming: bool
tsa_streaming_batch_size: int
validation_split_ratio: float
time_delta_cap: int
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].

property full_script_path: str | None

Get full path to the preprocessing script.

Returns:

Full path to the script

property preprocessing_environment_variables: Dict[str, str]

Get preprocessing-specific environment variables based on configuration.

These are static environment variables derived from config fields like target_positive_rate, time windows, and tag. Dynamic environment variables that depend on step inputs (like PREPROCESSOR_PATH) are added by the builder at runtime when the step is created.

Returns:

Dictionary mapping environment variable names to values

classmethod validate_entry_point_relative(v)[source]

Ensure processing_entry_point is a non‐empty relative path.

classmethod validate_job_type(v)[source]

Ensure job_type is one of the allowed values.

classmethod validate_target_positive_rate(v)[source]

Ensure target_positive_rate is between 0 and 1 (inclusive).

classmethod validate_time_window(v)[source]

Ensure time window is a positive integer.

initialize_derived_fields()[source]

Initialize all derived fields once after validation.

get_public_init_fields()[source]

Override get_public_init_fields to include TSA preprocessing specific fields.

Returns:

Dictionary of field names to values for child initialization

Return type:

Dict[str, Any]

model_dump(**kwargs)[source]

Override model_dump to include derived properties.

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.