diff options
| author | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-02-05 12:42:12 -0500 |
|---|---|---|
| committer | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-02-05 12:42:12 -0500 |
| commit | 86208a1bd7e6a7735340b318be4b40ced8448f1a (patch) | |
| tree | 761c8b2f4d187c7060881b593eda111824137d66 /src | |
| parent | dccbac2e2b99e46f64470ab7c23fe8f0f50ce9aa (diff) | |
| download | cascades-86208a1bd7e6a7735340b318be4b40ced8448f1a.tar.gz | |
adding four figures
Diffstat (limited to 'src')
| -rw-r--r-- | src/convex_optimization.py | 2 | ||||
| -rw-r--r-- | src/make_plots.py | 60 |
2 files changed, 57 insertions, 5 deletions
diff --git a/src/convex_optimization.py b/src/convex_optimization.py index 8dc6f82..0d506e1 100644 --- a/src/convex_optimization.py +++ b/src/convex_optimization.py @@ -90,7 +90,7 @@ def diff_and_opt(M_val, w_val, f_x, f_xz): def F(x=None, z=None): if x is None: - return 0, cvxopt.matrix(-.001, (n,1)) + return 0, cvxopt.matrix(-.1, (n,1)) elif z is None: y, y_diff = f_x(x, M_val, w_val) return cvxopt.matrix(float(y), (1, 1)),\ diff --git a/src/make_plots.py b/src/make_plots.py index d83eb2c..792e325 100644 --- a/src/make_plots.py +++ b/src/make_plots.py @@ -108,6 +108,58 @@ def plot_barabasi_albert_graph(): +def plot_kronecker_l2norm(): + plt.clf() + fig = plt.figure(1) + x = [50, 100, 500, 1000, 2000] + sparse_recov = [62, 60, 36, 28, 21] + max_likel = [139, 101, 42, 31, 25] + lasso = [50, 48, 33, 29, 23] + + fig, ax = plt.subplots() + + plt.subplots_adjust(bottom=.2, top=.85) + plt.xticks(ha="right", rotation=45) + + plt.axis((50, 2000, 0, 145)) + plt.xlabel("Number of Cascades") + plt.ylabel("l2-norm") + plt.grid(color="lightgrey") + ax.plot(x, lasso, 'ko-', color="orange", label="Lasso") + ax.plot(x, max_likel, 'ko-', color="cornflowerblue", label="MLE") + ax.plot(x, sparse_recov, 'ko-', color="k", label="Our Method") + plt.legend(loc="upper right") + ax.set_xticks(x) + ax.set_xticklabels(tuple(x)) + plt.savefig("../paper/figures/"+"kronecker_l2_norm.pdf") + + +def plot_kronecker_l2norm_nonsparse(): + plt.clf() + fig = plt.figure(1) + x = [50, 100, 500, 1000, 2000] + sparse_recov = [56, 55, 28, 21, 15] + max_likel = [125, 80, 35, 25, 20] + lasso = [47, 47, 27, 22, 17] + + fig, ax = plt.subplots() + + plt.subplots_adjust(bottom=.2, top=.85) + plt.xticks(ha="right", rotation=45) + + plt.axis((50, 2000, 0, 145)) + plt.xlabel("Number of Cascades") + plt.ylabel("l2-norm") + plt.grid(color="lightgrey") + ax.plot(x, lasso, 'ko-', color="orange", label="Lasso") + ax.plot(x, max_likel, 'ko-', color="cornflowerblue", label="MLE") + ax.plot(x, sparse_recov, 'ko-', color="k", label="Our Method") + plt.legend(loc="upper right") + ax.set_xticks(x) + ax.set_xticklabels(tuple(x)) + plt.savefig("../paper/figures/"+"kronecker_l2_norm_nonsparse.pdf") + + def plot_ROC_curve(figure_name): """ plot information in a pretty way @@ -168,8 +220,8 @@ if __name__=="__main__": #convex_optimization.type_lasso) if 1: compute_graph("../datasets/kronecker_graph_256_cross.txt", - n_cascades=2000, lbda=0.1, min_proba=.2, max_proba=.7, + n_cascades=50, lbda=0., min_proba=.2, max_proba=.7, passed_function= - #convex_optimization.sparse_recovery, - convex_optimization.type_lasso, - sparse_edges=False)
\ No newline at end of file + convex_optimization.sparse_recovery, + #convex_optimization.type_lasso, + sparse_edges=True)
\ No newline at end of file |
