由于电脑配置原因,用CNN训练较大的数据集较慢,因此选用了自己以前用随机森林的机器学习例子
源代码
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import nni
import logging
import numpy as np
'''
This project is for automatically tuning parameters for RandomForestClassifier.
'''
LOG = logging.getLogger('auto-RF')
max_min_scaler = lambda x : (x-np.min(x))/(np.max(x)-np.min(x))
#
def get_default_parameters():
params = {
'n_estimators': 450,
'max_features':'sqrt'