In [1]:
import pymongo
from pymongo import MongoClient
import pandas as pd
import matplotlib.pyplot as plt
In [2]:
%matplotlib nbagg
In [17]:
result_db_name = 'rllab'
exp_key = 'test11'
host = 'localhost'
port = 1234
In [18]:
client = MongoClient(host, port)
db = client[result_db_name]
jobs = db.jobs
In [19]:
df = pd.DataFrame(list(jobs.find({'exp_key':exp_key})))
param_dicts = []
score_curves = []
for i in range(df.shape[0]):
res = df.result.iat[i]
if res['status'] == 'ok':
resdict = res['params']
resdict['score'] = -df.result[i]['loss']
resdict['result_index'] = i
score_curves.append(res['scores']) # this only works if your function to process results returns the learning curve
param_dicts.append(resdict)
param_df = pd.DataFrame(param_dicts)
In [20]:
param_df
Out[20]:
In [21]:
best_score_index = param_df.score.values.argmax()
plt.figure()
plt.plot(score_curves[best_score_index])
plt.xlabel('Learning algo iter')
plt.ylabel('Average return')
Out[21]:
In [22]:
plt.figure()
plt.plot(param_df.score.rolling(window=2).max())
plt.title('Rolling max of hyperopt score progression')
plt.xlabel('Hyperopt iter')
plt.ylabel('Score')
Out[22]:
In [ ]: