from sklearn.preprocessing import StandardScaler | |
def scale_features(X_train, X_test): | |
""" | |
Scale features using StandardScaler. | |
Args: | |
X_train (pd.DataFrame): Training features. | |
X_test (pd.DataFrame): Testing features. | |
Returns: | |
X_train_scaled, X_test_scaled: Scaled features. | |
""" | |
scaler = StandardScaler() | |
X_train_scaled = scaler.fit_transform(X_train) | |
X_test_scaled = scaler.transform(X_test) | |
return X_train_scaled, X_test_scaled | |