Skip to content

Commit

Permalink
f hat and g hat take D_cand as argument in plot labels
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhoag committed Sep 26, 2022
1 parent 97719ff commit 986f7ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/loan_tutorial/plot_loan_cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
cs_file = './logs/candidate_selection_log0.p'
savename = './loan_cs.png'
solution_dict = load_pickle(cs_file)
save=True
show= not save
save=False
show=not save
fig = plot_gradient_descent(solution_dict,
primary_objective_name='log loss',
save=save,savename=savename)
Expand Down
5 changes: 3 additions & 2 deletions seldonian/utils/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def plot_gradient_descent(
ax_f = axes_this_constraint[0]
ax_f.plot(np.arange(len(f_vals)),f_vals,linewidth=2)
ax_f.set_xlabel("Iteration")
ax_f.set_ylabel(rf"$\hat{{f}}(\theta)$: {primary_objective_name}",fontsize=fontsize)

ax_f.set_ylabel(rf"$\hat{{f}}(\theta,D_\mathrm{{cand}})$: {primary_objective_name}",fontsize=fontsize)
ax_f.axvline(x=best_index,linestyle='--',color='k')
ax_f.axhline(y=best_f,linestyle='--',color='k')

Expand Down Expand Up @@ -97,7 +98,7 @@ def plot_gradient_descent(
best_L = L_vals[best_index]
ax_L.axhline(y=best_L,linestyle='--',color='k')

title = rf"KKT optimization for $L(\theta,\lambda) = \hat{{f}}(\theta) + \sum_{{k=1}}^{{{n_constraints}}}{{\lambda_k}} \mathrm{{HCUB}}(\hat{{g}}_k(\theta)) $"
title = rf"KKT optimization for $L(\theta,\lambda) = \hat{{f}}(\theta,D_\mathrm{{cand}}) + \sum_{{k=1}}^{{{n_constraints}}}{{\lambda_k}} \mathrm{{HCUB}}(\hat{{g}}_k(\theta,D_\mathrm{{cand}})) $"
plt.suptitle(title)
plt.tight_layout()
if save:
Expand Down

0 comments on commit 986f7ec

Please sign in to comment.