Spaces:
Sleeping
Sleeping
Download app/feature_engineering.py from SelliCapstone/selli_ml_deployment: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/spaces/SelliCapstone/selli_ml_deployment/resolve/main/app/feature_engineering.py
- Command line
-
hf download hf://spaces/SelliCapstone/selli_ml_deployment/app/feature_engineering.py
-
curl -L -o feature_engineering.py https://huggingface.co/spaces/SelliCapstone/selli_ml_deployment/resolve/main/app/feature_engineering.py
584 Bytes
| """Feature engineering functions untuk Bank Marketing model.""" | |
| import numpy as np | |
| import pandas as pd | |
| def add_features(df): | |
| """ | |
| Menambahkan engineered features ke DataFrame. | |
| Features yang ditambahkan: | |
| - duration_sq: duration ** 2 | |
| - campaign_log: log(1 + campaign) | |
| Args: | |
| df: DataFrame dengan kolom 'duration' dan 'campaign' | |
| Returns: | |
| DataFrame dengan kolom tambahan | |
| """ | |
| df = df.copy() | |
| df['duration_sq'] = df['duration'] ** 2 | |
| df['campaign_log'] = np.log1p(df['campaign']) | |
| return df | |