예제 #1
0
def do_MLP(X, y, X_test, y_test):
    #params = {
    #    'hidden_layer_sizes':[(10,10,10),4*(10,),5*(10,),6*(10,),7*(10,),8*(10,),9*(10,),(100,),(10,10,),(10,10,10,)],
    #    'activation':['relu','identity'],
    #    'solver':['sgd','adam'],
    #    'random_state':[42,],
    #    'verbose':[3,],
    #
    #}
    #mlp = GridSearchCV(estimator=MLPRegressor(), param_grid=params, scoring='r2')
    mlp = MLPRegressor(hidden_layer_sizes=7 * (10, ), random_state=42)
    mlp.fit(X, y)
    #print(mlp.cv_results_)
    #print(mlp.best_params_)
    mlp.test_score = mlp.score(X_test, y_test)
    print('MLP score:', mlp.test_score)
    return mlp