Created
April 5, 2019 11:47
-
-
Save gabraganca/4c8669c8be4a95065bb3a58dfa2377ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a grade de hiperparâmetros | |
param_grid = { | |
'n_factors': [10, 100, 200, 400], | |
'lr_all': [0.002, 0.005, 0.007, 0.009], | |
'n_epochs':[20, 100, 200, 400] | |
} | |
# Ajusta os modelos na grade com Validação Cruzada | |
gs = GridSearchCV(SVD, param_grid, measures=['mae', 'rmse'], cv=5, n_jobs=-1) | |
gs.fit(data) | |
# Mostra os melhores parãmetros encontrados para MAE e RMSE | |
## RMSE | |
print(f"RMSE:{gs.best_score['rmse']:.3f}") | |
print(gs.best_params['rmse']) | |
## MAE | |
print(f"MAE:{gs.best_score['mae']:.3f}") | |
print(gs.best_params['mae']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment