January 2020
Beginner to intermediate
432 pages
11h 24m
English
We can also inspect the contents of the trials object to see how the algorithm worked.
from pandas.io.json import json_normalizefrom hyperopt.pyll.stochastic import sample
results_df = pd.DataFrame(trials.results)params_df = json_normalize(results_df['params'])results_df = pd.concat([results_df.drop('params', axis=1), params_df], axis=1)results_df['iteration'] = np.arange(len(results_df)) + 1
We had to prepare the DataFrame containing the required information per each iteration: the hyperparameters and the value of the loss function. We can extract the information from trials.results (this is also why we passed the params object to the resulting dictionary ...
Read now
Unlock full access