def scale_sets(x_train, x_test, classifier_name):
"""
:param x_train: ndarray, required
- The train data of the feature matrix
:param x_test: ndarray, required
- The test data of the feature matrix
:param classifier_name: string, optional
- The name of the selected classifier
:return: ndarray
"""
# scaling leads to poorer performance in the case of random forests, xgb, etc.
if classifier_name not in ["random_forests", "XGB", "GBC"]:
# x_train, x_test are expected to be numpy arrays. Simple conditions such as if x_train will raise a ValueError.
x_train = scale(x_train) if x_train is not None else x_train
x_test = scale(x_test) if x_test is not None else x_test
return x_train, x_test
评论列表
文章目录