From 92ea33105921065e52bce2c1ec12b81bd5ad0fd9 Mon Sep 17 00:00:00 2001 From: jeanpouget-abadie Date: Wed, 4 Feb 2015 10:03:24 -0500 Subject: adding figure --- src/convex_optimization.py | 4 ++-- src/make_plots.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/convex_optimization.py b/src/convex_optimization.py index ed99e6b..3111e50 100644 --- a/src/convex_optimization.py +++ b/src/convex_optimization.py @@ -48,7 +48,7 @@ def sparse_recovery(lbda, n_cascades): return f_x, f_xz -def type_lasso(lbda): +def type_lasso(lbda, n_cascades): """ Solves: min - sum_j theta_j + lbda*|e^{M*theta} - (1 - w)|_2 @@ -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(-.1, (n,1)) + return 0, cvxopt.matrix(-.00001, (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 d28d07e..cbe027e 100644 --- a/src/make_plots.py +++ b/src/make_plots.py @@ -49,11 +49,11 @@ def plot_graph(figure_name): plot information in a pretty way """ plt.clf() - x = [100, 500, 1000, 2000, 5000] - greedy = [.15, .4, .63, .82, .92] - lasso = [.30, .46, .65, 0, 0] - max_likel = [.29, .67, .8, .87, .9] - sparse_recov = [.32, .7, .82, .89, 0] + x = [50, 100, 500, 1000, 2000, 5000] + greedy = [.09, .15, .4, .63, .82, .92] + lasso = [.07, .30, .46, .65, 0, 0] + max_likel = [.21, .29, .67, .8, .87, .9] + sparse_recov = [.25, .32, .7, .82, .89, .92] plt.axis((0, 5000, 0, 1)) plt.xlabel("Number of Cascades") plt.ylabel("F1 score") @@ -68,4 +68,6 @@ def plot_graph(figure_name): if __name__=="__main__": watts_strogatz(n_cascades=5000, lbda=.002, passed_function= - convex_optimization.sparse_recovery) \ No newline at end of file + #convex_optimization.sparse_recovery) + #algorithms.greedy_prediction) + convex_optimization.type_lasso) \ No newline at end of file -- cgit v1.2.3-70-g09d2