SIENTIAPDE-1253: Implement business rule validation for training parameters. Adds a validate_business_rules method to the TrainModelParams class to enforce constraints on training parameters, improving data integrity and preventing errors. Also updates tests to include target variable in variable columns and adds tests for business rule validations.
This commit is contained in:
@@ -88,10 +88,12 @@ class Training(BaseActivity):
|
||||
try:
|
||||
self.info('Validating training parameters', metadata)
|
||||
|
||||
# Convert input_data directly to TrainModelParams (this validates all fields)
|
||||
# The from_dict method will extract only the fields it needs
|
||||
# Step 1: Convert input_data to TrainModelParams (validates types and required fields)
|
||||
train_params = TrainModelParams.from_dict(input_data)
|
||||
|
||||
# Step 2: Validate business rules (ranges, consistency, etc.)
|
||||
train_params.validate_business_rules()
|
||||
|
||||
self.info(
|
||||
f'Training parameters validated successfully - '
|
||||
f'Target: {train_params.target_variable}, '
|
||||
|
||||
Reference in New Issue
Block a user