Skip to content

Commit

Permalink
Make burin optional for community_generative_model
Browse files Browse the repository at this point in the history
  • Loading branch information
arastuie committed Jul 14, 2020
1 parent ba9eb82 commit 59075b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions chip_generative_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def generate_hawkes_for_single_node_block_pair(bp_mu, bp_alpha, bp_beta,
return bp_event_dict


def community_generative_model(num_nodes, class_prob, bp_mu, bp_alpha, bp_beta, burnin, end_time, n_cores=1, seed=None):
def community_generative_model(num_nodes, class_prob, bp_mu, bp_alpha, bp_beta, end_time, burnin=None, n_cores=1,
seed=None):
"""
Community Hawkes Independent Pairs (CHIP) generative model
as described in the paper titled "Consistent Community Detection in Continuous-Time Networks of Relational Events".
Expand Down Expand Up @@ -241,7 +242,7 @@ def degree_corrected_community_generative_model(num_nodes, class_prob,
node_membership, event_dicts = community_generative_model(number_of_nodes,
class_probabilities,
bp_mu, bp_alpha, bp_beta,
burnin, end_time, seed=seed)
end_time, burnin=burnin, seed=seed)
toc = time.time()

print(toc - tic)
Expand All @@ -250,7 +251,7 @@ def degree_corrected_community_generative_model(num_nodes, class_prob,
node_memberships, event_dictss = community_generative_model(number_of_nodes,
class_probabilities,
bp_mu, bp_alpha, bp_beta,
burnin, end_time, n_cores=-1, seed=seed)
end_time, burnin=burnin, n_cores=-1, seed=seed)
toc = time.time()
print(toc - tic)

Expand Down
2 changes: 1 addition & 1 deletion generative_model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def simulate_community_hawkes(params=None, network_name=None, load_if_exists=Fal
node_membership, event_dict = chip.community_generative_model(number_of_nodes,
class_probabilities,
bp_mu, bp_alpha, bp_beta,
burnin, end_time,
end_time, burnin=burnin,
n_cores=default_params['n_cores'], seed=seed)

node_membership = one_hot_to_class_assignment(node_membership)
Expand Down
2 changes: 1 addition & 1 deletion model_fitting_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def generate_fit_community_hawkes(event_dict, node_membership,

generated_node_membership, generated_event_dict = community_generative_model(n_nodes, class_prob,
bp_mu, bp_alpha, bp_beta,
burnin=None, end_time=duration,
end_time=duration, burnin=None,
n_cores=n_cores, seed=seed)

if plot_hist:
Expand Down
1 change: 0 additions & 1 deletion parameter_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import tick.hawkes as tick
import matplotlib.pyplot as plt
import generative_model_utils as utils
from chip_generative_model import community_generative_model
from scipy.optimize import minimize_scalar, minimize


Expand Down

0 comments on commit 59075b7

Please sign in to comment.