From e8369874088c0ae4b1d98f79f5bae3319de2ac6d Mon Sep 17 00:00:00 2001 From: jeanpouget-abadie Date: Sun, 1 Feb 2015 16:33:04 -0500 Subject: updating code to Python 3 --- src/make_plots.py | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'src/make_plots.py') diff --git a/src/make_plots.py b/src/make_plots.py index 1951576..5aab683 100644 --- a/src/make_plots.py +++ b/src/make_plots.py @@ -6,32 +6,6 @@ import algorithms import rip_condition -def plot_rip_numberofnodes(max_proba, n_min, n_max, p_init, n_cascades, K_max): - """ - Plots the RIP constant for varying number of nodes (n_max included) - """ - x = np.arange(n_min, n_max+1) - y = [] - - for n_nodes in x: - print(n_nodes) - G = cascade_creation.InfluenceGraph(max_proba=.3) - G.erdos_init(n=n_nodes, p=.1) # TODO: handle different inits! - cascades = cascade_creation.generate_cascades(G, p_init=p_init, - n_cascades=n_cascades) - M, __ = cascade_creation.icc_matrixvector_for_node(cascades, None) - M = cascade_creation.normalize_matrix(M) - y.append(rip_condition.find_kth_rip_constants(M, 4)) # - - print(y) - - plt.clf() - plt.plot(x, y) - #plt.show() - - return x, y - - def compare_greedy_and_lagrange_cs284r(): """ Compares the performance of the greedy algorithm on the @@ -40,7 +14,7 @@ def compare_greedy_and_lagrange_cs284r(): """ G = cascade_creation.InfluenceGraph(max_proba = .8) G.import_from_file("../datasets/subset_facebook_SNAPnormalize.txt") - A = cascade_creation.generate_cascades(G, p_init=.05, n_cascades=2000) + A = cascade_creation.generate_cascades(G, p_init=.05, n_cascades=100) #Greedy G_hat = algorithms.greedy_prediction(G, A) @@ -57,9 +31,6 @@ def test(): """ unit test """ - if 0: - plot_rip_numberofnodes(max_proba=.3, n_min=30, n_max=30, - p_init=.01, n_cascades=100, K_max=4) if 1: compare_greedy_and_lagrange_cs284r() -- cgit v1.2.3-70-g09d2