{#- Context variables:
   - catalog: str (e.g., "acme_fsi_demo")
   - industry: str (e.g., "fsi")
-#}
# ML Training — Local Context

## Decimal to float casting (REQUIRED)
Spark DecimalType becomes Python decimal.Decimal in pandas.
sklearn/xgboost CANNOT handle these. ALWAYS cast after .toPandas():

    for col in numeric_columns:
        df[col] = pd.to_numeric(df[col], errors='coerce')

## Feature Name Contracts
Prefer discovering features dynamically from the table schema:

    feature_cols = [c.name for c in spark.table(table).schema
                    if c.name not in ('customer_id', 'label', 'is_fraud')]

This avoids hardcoded name mismatches between feature engineering and training.

## MLflow
- Log params, metrics, and model in every training notebook
- Register in Unity Catalog: mlflow.register_model(...)
- Use autolog: mlflow.sklearn.autolog() or mlflow.xgboost.autolog()
