aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeanpouget-abadie <jean.pougetabadie@gmail.com>2015-02-03 23:56:58 -0500
committerjeanpouget-abadie <jean.pougetabadie@gmail.com>2015-02-03 23:56:58 -0500
commitd91db65bf9c3db5e3dd53c41576b0fc1b866c8ce (patch)
tree56520520a8db0e36a4a6bc760290e6ac44e80f49
parent984201af47a7b3a8701a2d5f6a50fc55ef666681 (diff)
downloadcascades-d91db65bf9c3db5e3dd53c41576b0fc1b866c8ce.tar.gz
adding figure
-rw-r--r--paper/sections/experiments.tex6
-rw-r--r--src/convex_optimization.py2
-rw-r--r--src/make_plots.py24
3 files changed, 30 insertions, 2 deletions
diff --git a/paper/sections/experiments.tex b/paper/sections/experiments.tex
index f4acc06..5d1ae45 100644
--- a/paper/sections/experiments.tex
+++ b/paper/sections/experiments.tex
@@ -1,3 +1,9 @@
+\begin{figure}
+\includegraphics[scale=.4]{figures/first_try.pdf}
+\caption{Watts-Strogatz Model. 300 nodes, 20000 edges.}
+\end{figure}
+
+
\begin{itemize}
\item Compare edge recovery to First Edge and Greedy as number of cascades grows on different types of graphs...
\item Plot upper-bound of parameters in graph as number of cascades grows
diff --git a/src/convex_optimization.py b/src/convex_optimization.py
index 913fcb4..ed99e6b 100644
--- a/src/convex_optimization.py
+++ b/src/convex_optimization.py
@@ -80,7 +80,7 @@ def type_lasso(lbda):
return f_x, f_xz
-@timeout.timeout(30)
+@timeout.timeout(70)
def diff_and_opt(M_val, w_val, f_x, f_xz):
if M_val.dtype == bool:
diff --git a/src/make_plots.py b/src/make_plots.py
index cb78034..d28d07e 100644
--- a/src/make_plots.py
+++ b/src/make_plots.py
@@ -44,6 +44,28 @@ def watts_strogatz(n_cascades, lbda, passed_function):
algorithms.correctness_measure(G, G_hat, print_values=True)
+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]
+ plt.axis((0, 5000, 0, 1))
+ plt.xlabel("Number of Cascades")
+ plt.ylabel("F1 score")
+ plt.grid(color="lightgrey")
+ plt.plot(x, greedy, 'ko-', color="lightseagreen", label='Greedy')
+ plt.plot(x, lasso, 'ko-', color="orange", label="Lasso")
+ plt.plot(x, max_likel, 'ko-', color="coral", label="MLE")
+ plt.plot(x, sparse_recov, 'ko-', color="k", label="Sparse MLE")
+ plt.legend(loc="lower right")
+ plt.savefig("../paper/figures/"+figure_name)
+
+
if __name__=="__main__":
- watts_strogatz(n_cascades=2000, lbda=.002, passed_function=
+ watts_strogatz(n_cascades=5000, lbda=.002, passed_function=
convex_optimization.sparse_recovery) \ No newline at end of file