diff options
| author | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-02-06 10:48:51 -0500 |
|---|---|---|
| committer | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-02-06 10:48:51 -0500 |
| commit | f94bf128133f8dc3adaa81282ed7ce54b55dd528 (patch) | |
| tree | 5556540fc780e5895b0549309151400e746d137b | |
| parent | 1e4c30be775fc87164e8559e6f3f34491295e4b6 (diff) | |
| download | cascades-f94bf128133f8dc3adaa81282ed7ce54b55dd528.tar.gz | |
changing figures
| -rw-r--r-- | paper/figures/watts_strogatz_p_init.pdf | bin | 0 -> 14058 bytes | |||
| -rw-r--r-- | paper/sections/experiments.tex | 26 | ||||
| -rw-r--r-- | src/make_plots.py | 40 |
3 files changed, 50 insertions, 16 deletions
diff --git a/paper/figures/watts_strogatz_p_init.pdf b/paper/figures/watts_strogatz_p_init.pdf Binary files differnew file mode 100644 index 0000000..da6dc99 --- /dev/null +++ b/paper/figures/watts_strogatz_p_init.pdf diff --git a/paper/sections/experiments.tex b/paper/sections/experiments.tex index 48ffc02..f1b7d52 100644 --- a/paper/sections/experiments.tex +++ b/paper/sections/experiments.tex @@ -1,17 +1,21 @@ -\begin{figure} -\includegraphics[scale=.4]{figures/ROC_curve.pdf} -\caption{Precision-Recall curve Holme-Kim Model. 200 nodes, 16200 edges.} -\end{figure} +% \begin{figure} +% \includegraphics[scale=.4]{figures/ROC_curve.pdf} +% \caption{Precision-Recall curve Holme-Kim Model. 200 nodes, 16200 edges.} +% \end{figure} +% & \includegraphics[scale=.23]{figures/kronecker_l2_norm.pdf} +% & \includegraphics[scale=.23]{figures/kronecker_l2_norm_nonsparse.pdf}\\ \begin{table*}[t] \centering -\begin{tabular}{c c c c} - -\includegraphics[scale=.21]{figures/barabasi_albert.pdf} -& \includegraphics[scale=.21]{figures/watts_strogatz.pdf} -& \includegraphics[scale=.23]{figures/kronecker_l2_norm.pdf} -& \includegraphics[scale=.23]{figures/kronecker_l2_norm_nonsparse.pdf}\\ -(a) Barabasi-Albert & (b) Watts-Strogatz & (c) sparse Kronecker & (d) non-sparse Kronecker +\begin{tabular}{c c c} +\includegraphics[scale=.3]{figures/barabasi_albert.pdf} +& \includegraphics[scale=.3]{figures/watts_strogatz.pdf} +& \includegraphics[scale=.3]{figures/ROC_curve.pdf} \\ +(a) Barabasi-Albert (F$1$ \emph{vs.} $n$) & (b) Watts-Strogatz (F$1$ \emph{vs.} $n$) & (c) Holme-Kilm (Prec-Recall) \\ + \includegraphics[scale=.3]{figures/kronecker_l2_norm.pdf} +& \includegraphics[scale=.3]{figures/kronecker_l2_norm_nonsparse.pdf} +& \includegraphics[scale=.3]{figures/watts_strogatz_p_init.pdf} \\ +(d) Sparse Kronecker ($\ell_2$-norm \emph{vs.} $n$ ) & (e) Non-sparse Kronecker ($\ell_2$-norm \emph{vs.} $n$) & (f) Watts-Strogatz (F$1$ \emph{vs.} $p_{\text{init}}$) \end{tabular} \captionof{figure}{Figures (a) and (b) report the F$1$-score in $\log$ scale for 2 graphs: (a) Barabasi-Albert graph, $300$ nodes, $16200$ edges. (b) diff --git a/src/make_plots.py b/src/make_plots.py index 840cc94..c5a50f6 100644 --- a/src/make_plots.py +++ b/src/make_plots.py @@ -28,7 +28,7 @@ def compare_greedy_and_lagrange_cs284r(): def compute_graph(graph_name, n_cascades, lbda, passed_function, min_proba, - max_proba, sparse_edges=False): + max_proba, sparse_edges=False, p_init=.05): """ Test running time on different algorithms """ @@ -36,7 +36,7 @@ def compute_graph(graph_name, n_cascades, lbda, passed_function, min_proba, min_proba=min_proba, sparse_edges=sparse_edges) G.import_from_file(graph_name) - A = cascade_creation.generate_cascades(G, p_init=.05, n_cascades=n_cascades) + A = cascade_creation.generate_cascades(G, p_init=p_init, n_cascades=n_cascades) if passed_function==algorithms.greedy_prediction: G_hat = algorithms.greedy_prediction(G, A) @@ -184,6 +184,7 @@ def plot_ROC_curve(figure_name): plt.xlabel("Recall") plt.ylabel("Precision") plt.grid(color="lightgrey") + ax.plot(recall_lasso_200, precision_lasso_200, 'ko-', color="lightseagreen", label="Lasso-200 cascades") ax.plot(recall_sparse_200, precision_sparse_200, 'ko-', @@ -196,14 +197,43 @@ def plot_ROC_curve(figure_name): plt.savefig("../paper/figures/"+"ROC_curve.pdf") +def plot_kronecker_l2norm_nonsparse(): + plt.clf() + fig = plt.figure(1) + x = [.01, .05, .1, .15, .2] + greedy = [.43, .29, .18, .1, .08] + sparse_recov = [.7, .58, .48, .39, .31] + max_likel = [.69, .56, .45, .37, .3] + lasso = [.66, .55, .46, .38, .3] + + 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, greedy, 'ko-', color="lightseagreen", label='Greedy') + 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/"+"watts_strogatz_p_init.pdf") + + + if __name__=="__main__": if 1: compute_graph("../datasets/watts_strogatz_300_30_point3.txt", - n_cascades=300, lbda=.01, min_proba=.2, max_proba=.7, + n_cascades=300, lbda=.013382, min_proba=.2, max_proba=.7, passed_function= #convex_optimization.sparse_recovery) - #algorithms.greedy_prediction) - convex_optimization.sparse_recovery, p_init=.15) + algorithms.greedy_prediction, p_init=.2) + #convex_optimization.sparse_recovery, p_init=.15) if 0: compute_graph("../datasets/powerlaw_200_30_point3.txt", n_cascades=200, lbda=.01, min_proba=.2, max_proba=.7, |
