Xnew, Pnew = kf.filter_update(filtered_state_mean=Xold, filtered_state_covariance=Pold, observation=ys[t]) Pold = np.array(Pnew) Xold = np.array(Xnew) y[t - burn_in] = np.dot(Xnew, H) # ---------------------------------------- # # In[170]: # ---------- Plot ------------------------ # plt.subplot(211) plt.plot(ts, ys, label='noisy') # noisy measures plt.plot(ts[burn_in:Ns], y, label='filtered') # filtered measures plt.grid() plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=2, mode="expand", borderaxespad=0.) plt.subplot(212) residuals = ys.ravel()[burn_in:Ns] - y.ravel() plt.plot(ts[burn_in:Ns], residuals) plt.title('Durbin-Watson: {:.3f}'.format(sm.stats.durbin_watson(residuals))) plt.grid() plt.tight_layout() plt.show() # ---------------------------------------- # # In[ ]:
df = pd.concat(frames) df['ncalls'] = df['ncalls'].apply(lambda x: x.split('/')[0]) df['ncalls'] = df['ncalls'].astype(int) df = df[df[function_colname].str.contains("constph|openmm")] df = df.loc[df['Attempts/Update'] == 1] # df = df.loc[df[function_colname] == "constph.py:1035(update)"] # Initialize a grid of plots with an Axes for each walk # sns.swarmplot(data=df, x='NCMC steps', y='percall', hue=function_colname, ax=ax) for fname, fgroup in df.groupby(function_colname): f, ax = plt.subplots(figsize=(7, 7)) ax.set_title(fname) ax.scatter(fgroup["NCMC steps"], fgroup["percall.1"]) # sns.factorplot(data=df, x='NCMC steps', y='percall.1', hue=function_colname,ax=ax) plt.show()