This file contains hidden or 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
# Obtém os resultados do Grid Search | |
df_results = pd.DataFrame.from_dict(gs.cv_results) | |
df_results.columns = df_results.columns.str.replace('param_','') | |
# Grafica os mapas de calor | |
n_epochs = len(param_grid['n_epochs']) | |
fig, axes = plt.subplots(nrows=n_epochs, ncols=3, figsize=(22, 6*n_epochs)) | |
for ax_row, n_epoch in zip(axes, param_grid['n_epochs']): | |
for ax, metric in zip(ax_row, ['mae', 'rmse', 'time']): |
This file contains hidden or 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
# Treinando algoritmo obtido com menor MAE | |
algo_svd_mae = gs.best_estimator['mae'] | |
algo_svd_mae.fit(full_trainset) | |
print(get_rec_movies('Esposa', algo_svd_mae)) #Lista de filmes | |
# Treinando algoritmo obtido com menor RMSE | |
algo_svd_rmse = gs.best_estimator['rmse'] | |
algo_svd_rmse.fit(full_trainset) | |
print(get_rec_movies('Esposa', algo_svd_rmse)) #Lista de filmes |
OlderNewer