aboutsummaryrefslogtreecommitdiffstats
path: root/src/make_plots.py
diff options
context:
space:
mode:
authorjeanpouget-abadie <jean.pougetabadie@gmail.com>2015-02-04 14:05:47 -0500
committerjeanpouget-abadie <jean.pougetabadie@gmail.com>2015-02-04 14:05:47 -0500
commit71cf5d890df71701d0fd60f1907a1cc63b508cbf (patch)
tree9acbdf7ee08d1ceba8b15e4eac169680ab77bb82 /src/make_plots.py
parenta819813ca6c310d84a52de51e7bc49ea8dd8a726 (diff)
downloadcascades-71cf5d890df71701d0fd60f1907a1cc63b508cbf.tar.gz
adding precision_recall curve
Diffstat (limited to 'src/make_plots.py')
-rw-r--r--src/make_plots.py47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/make_plots.py b/src/make_plots.py
index 9b0fc11..1b3a9df 100644
--- a/src/make_plots.py
+++ b/src/make_plots.py
@@ -78,26 +78,31 @@ def plot_ROC_curve(figure_name):
plot information in a pretty way
"""
plt.clf()
- fig = plt.figure(1)
- #labels = [0, .00002, .002, .02, .2, .5]
- x_sparse = [.57, .6, .61, .76, .9]
- y_sparse = [.41, .4, .37, .16, .03]
-
- x_lasso = [.55, .56, .66]
- y_lasso = [.5, .43, .25]
+ fig = plt.figure(2)
fig, ax = plt.subplots()
- plt.axis((np.log(45), np.log(5500), 0, 1))
- plt.xlabel("Number of Cascades")
- plt.ylabel("F1 score")
+ recall_sparse_200 = [.03, .16, .37, .4, .49]
+ precision_sparse_200 = [.9, .76, .61, .6, .63]
+
+ recall_lasso_200 = [.02, .11, .25, .43, .5, .54]
+ precision_lasso_200 = [.77, .77, .66, .56, .55, .51]
+
+ recall_sparse_50 = [.07, .13, .16, .58]
+ precision_sparse_50 = [.56, .53, .49, .37]
+
+ recall_lasso_50 = [.03, .18, .27, .82]
+ precision_lasso_50 = [.6, .47, .44, .24]
+
+ plt.xlabel("Recall")
+ plt.ylabel("Precision")
plt.grid(color="lightgrey")
- ax.plot(x_lasso, y_lasso, 'ko-', color="orange", label="Lasso")
- ax.plot(x_sparse, y_sparse, 'ko-', color="k", label="Our Method")
- plt.legend(loc="lower right")
- ax.set_xticks(x)
- ax.set_xticklabels(tuple(labels))
- plt.savefig("../paper/figures/"+figure_name)
+ ax.plot(recall_lasso_200, precision_lasso_200, 'ko-', color="lightseagreen", label="Lasso-200 cascades")
+ ax.plot(recall_sparse_200, precision_sparse_200, 'ko-', color="k", label="Our Method-200 cascades")
+ ax.plot(recall_lasso_50, precision_lasso_50, 'ko-', color="orange", label="Lasso-50 cascades")
+ ax.plot(recall_sparse_50, precision_sparse_50, 'ko-', color="cornflowerblue", label="Our Method-50 cascades")
+ plt.legend(loc="upper right")
+ plt.savefig("../paper/figures/"+"ROC_curve.pdf")
if __name__=="__main__":
@@ -107,13 +112,13 @@ if __name__=="__main__":
#convex_optimization.sparse_recovery)
#algorithms.greedy_prediction)
convex_optimization.sparse_recovery)
- if 0:
+ if 1:
compute_graph("../datasets/powerlaw_200_30_point3.txt",
- n_cascades=300, lbda=.002, passed_function=
- convex_optimization.sparse_recovery)
+ n_cascades=200, lbda=.01, passed_function=
+ #convex_optimization.sparse_recovery)
#algorithms.greedy_prediction)
- #convex_optimization.type_lasso)
- if 1:
+ convex_optimization.type_lasso)
+ if 0:
compute_graph("../datasets/barabasi_albert_300_30.txt",
n_cascades=100, lbda=.002, passed_function=
convex_optimization.sparse_recovery)