cursus.steps.configs.config_piper_metric_generation_step

PIPER Metric Generation Step Configuration with Self-Contained Derivation Logic

This module implements the configuration class for the PIPER metric generation step using a self-contained design where derived fields are private with read-only properties.

PiperMetricGeneration is a peer / drop-in alternative to ModelMetricsComputation: it consumes the SAME upstream eval_output dependency (a *ModelEval / *ModelInference producer), recomputes ROC/PR curves itself from the prediction data, and emits the PIPER contract (.metric JSON files + paired 2-column data CSVs) written FLAT to the output root so PIPER can scan and render them.

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 PiperMetricGenerationConfig(*, 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=None, processing_entry_point='piper_metric_generation.py', processing_script_arguments=None, processing_framework_version='1.2-1', id_name, label_name, variant_model_id, score_field=None, score_fields=None, task_label_names=None, job_type='calibration', amount_field='order_amount', input_format='auto', compute_dollar_recall=True, compute_count_recall=True, generate_plots=True, dollar_recall_fpr=0.1, count_recall_cutoff=0.1, comparison_mode=False, previous_score_field='', previous_score_fields=None, comparison_metrics='all', statistical_tests=True, comparison_plots=True, control_model_id=None, dataset_type='Validation', metrics_to_render=<factory>, **extra_data)[source]

Bases: ProcessingStepConfigBase

Configuration for the PIPER metric generation step with self-contained derivation logic.

This class defines the configuration parameters for the PIPER metric generation step, which loads prediction data, recomputes ROC/PR curves, and emits the PIPER rendering contract: .metric JSON files (Graph-Line / Tabular visualization types) together with paired 2-column data CSVs, written FLAT to the processing output root (/opt/ml/processing/output) so PIPER can scan and render them.

It is a peer / drop-in alternative to ModelMetricsComputation and reuses the same comparison machinery (comparison_mode + previous_score_field). The current model is the “variant” series (score_field -> variant_model_id); the previous / active model is the “control” series (previous_score_field -> control_model_id).

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
variant_model_id: str
score_field: str | None
score_fields: List[str] | None
task_label_names: List[str] | None
processing_entry_point: str
job_type: str
amount_field: str | None
input_format: str
compute_dollar_recall: bool
compute_count_recall: bool
generate_plots: bool
dollar_recall_fpr: float
count_recall_cutoff: float
processing_framework_version: str
use_large_processing_instance: bool
comparison_mode: bool
previous_score_field: str
previous_score_fields: List[str] | None
comparison_metrics: str
statistical_tests: bool
comparison_plots: bool
control_model_id: str | None
dataset_type: str
metrics_to_render: List[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].

classmethod validate_input_format(v)[source]

Validate input format is supported.

classmethod validate_probability_range(v)[source]

Validate probability values are in valid range.

initialize_derived_fields()[source]

Initialize all derived fields once after validation.

validate_metric_generation_config()[source]

Additional validation specific to PIPER metric generation configuration

get_environment_variables()[source]

Get environment variables for the PIPER metric generation 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 PIPER metric generation specific fields. Gets a dictionary of public fields suitable for initializing a child config. Includes both base fields (from parent) and PIPER metric generation specific fields.

Returns:

Dictionary of field names to values for child initialization

Return type:

Dict[str, Any]

get_job_arguments()[source]

CLI args — config is the single source (FZ 31e1d3h).

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.