Skip to content

Commit

Permalink
style: clean up unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
jiachangliu committed Nov 3, 2023
1 parent 83b5582 commit 438d719
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/okridge/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@

import numpy as np

import matplotlib.pyplot as plt

from .node import Node, branch # , presolve

# from .utilities import branch, is_integral

from beamsearchregression.sparseBeamSearch import sparseLogRegModel_big_n
# from beamsearchregression.sparseBeamSearch import sparseLogRegModel_big_n
from .solvers import (
sparseLogRegModel_big_n as sparseLogRegModel_big_n_with_cache,
total_size,
Expand Down Expand Up @@ -395,32 +393,6 @@ def solve(
print("sub_beta is", sub_betas[loss_indices[i]])
beta_collections[i, nonzero_indices] = sub_betas[loss_indices[i]]


plt.figure()
plt.hist(loss_collections, bins=100)
plt.xlabel("loss")
plt.ylabel("frequency")
plt.title("top 1000 Rashomon set solutions")
plt.savefig("tmp_losses.png")

plt.figure()
plt.step(np.arange(1000), np.sort(loss_collections))
plt.xlabel("loss ranking index")
plt.ylabel("loss")
plt.title("loss step plot of top 1000 Rashomon set solutions")
plt.savefig("tmp_losses_step.png")

plt.figure()
beta_collections_mean = np.mean(beta_collections, axis=0)
beta_collections_std = np.std(beta_collections, axis=0)
plt.errorbar(np.arange(self.data.p), beta_collections_mean, yerr=beta_collections_std, fmt='o')
plt.xlabel("feature index")
plt.ylabel("beta")
plt.title("coefficients of top 1000 Rashomon set solutions")
plt.savefig("tmp_losses_beta.png")

sys.exit()

if not (self.bfs_queue.qsize() > 0 or self.dfs_queue.qsize() > 0):
print("There are no nodes left in the queue")
# update lower bound and gap
Expand Down

0 comments on commit 438d719

Please sign in to comment.