classification.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:nba-games 作者: ixarchakos 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号