Models conversion module

This module provides functions to estimate model parameters from existing temporal networks which then can be passed to

tacoma.model_conversions.ZSBB_b0_func(b0, lam)[source]
tacoma.model_conversions.ZSBB_mean_coordination_number(b0, lam, N, b1)[source]

Compute the mean coordination number of the ZSBB model.

tacoma.model_conversions.estimate_ZSBB_args(temporal_network, group_sizes_and_durations=None, fit_discrete=False, dt=None)[source]
tacoma.model_conversions.estimate_dynamic_RGG_args(sampled_or_binned_temporal_network, dt=None, periodic_boundary_conditions_for_link_building=True, group_sizes_and_durations=None)[source]
tacoma.model_conversions.estimate_flockwork_P_args(temporal_network, *args, **kwargs)[source]

Bins an edge_changes instance for each dt (after each step, respectively, if N_time_steps was provided) and computes the rewiring rate gamma and probability to stay alone P from the binned edges_in and edges_out. For DTU data use dt = 3600, for sociopatterns use dt = 600.

Parameters:
  • temporal_network (_tacoma.edge_changes, _tacoma.edge_lists, _tacoma.edge_changes_with_histograms, or _tacoma.edge_lists_with_histograms) – An instance of a temporal network.
  • t_run_total (float) – this is just plainly copied to the returned kwargs. If it is set to None, t_run_total will be set to temporal_network.tmax
  • dt (float) – The demanded bin size. default : 0.0
  • N_time_steps (int) – Number of time bins (use either this or dt). default : 0
  • aggregated_network (dict of tuple of int -> float, optional) – dict(edge -> similarity), if this is given, the kwargs are supposed to be for the function flockwork_P_varying_rates_neighbor_affinity, you can get this network from the aggregated_network property from the results returned by measure_group_sizes_and_durations. default : {}
  • ensure_empty_network (bool, optional) – if this is True, bins where the original network is empty (n_edges = 0) will be an artificially set high gamma with P = 0, such that nodes will lose all edges. default : False
  • use_preferential_node_selection (bool, optional) – this is just plainly copied to the returned kwargs if aggregated_network is not empty. default : False
  • verbose (bool, optional) – Be chatty.
Returns:

kwargs for the functions flockwork_P_varying_rates or flockwork_P_varying_rates_neighbor_affinity, if aggregated_network was provided

Return type:

dict

tacoma.model_conversions.estimate_flockwork_P_args_for_single_nodes(temporal_network, use_event_rate_method=False, *args, **kwargs)[source]

Bins an edge_changes instance for each dt (after each step, respectively, if N_time_steps was provided) and computes the rewiring rate gamma and probability to stay alone P from the binned edges_in and edges_out. Additionally

Parameters:
  • temporal_network (_tacoma.edge_changes, _tacoma.edge_lists, _tacoma.edge_changes_with_histograms, or _tacoma.edge_lists_with_histograms) – An instance of a temporal network.
  • t_run_total (float) – this is just plainly copied to the returned kwargs. If it is set to None, t_run_total will be set to temporal_network.tmax
  • dt (float) – The demanded bin size. default : 0.0
  • N_time_steps (int) – Number of time bins (use either this or dt). default : 0
  • aggregated_network (dict of tuple of int -> float, optional) – dict(edge -> similarity), if this is given, the kwargs are supposed to be for the function flockwork_P_varying_rates_neighbor_affinity, you can get this network from the aggregated_network property from the results returned by measure_group_sizes_and_durations. default : {}
  • ensure_empty_network (bool, optional) – if this is True, bins where the original network is empty (n_edges = 0) will be an artificially set high gamma with P = 0, such that nodes will lose all edges. default : False
  • use_preferential_node_selection (bool, optional) – this is just plainly copied to the returned kwargs if aggregated_network is not empty. default : False
  • verbose (bool, optional) – Be chatty.
Returns:

kwargs for the functions flockwork_P_varying_rates or flockwork_P_varying_rates_neighbor_affinity, if aggregated_network was provided

Return type:

dict

tacoma.model_conversions.estimate_flockwork_alpha_beta_args(temporal_network, *args, **kwargs)[source]

Bins an edge_changes instance for each dt (after each step, respectively, if N_time_steps was provided) and computes the reconnection rate alpha and disconnection rate beta from the binned edges_in and edges_out. For DTU data use dt = 3600, for sociopatterns use dt = 600.

Parameters:
  • temporal_network (_tacoma.edge_changes, _tacoma.edge_lists, _tacoma.edge_changes_with_histograms, or _tacoma.edge_lists_with_histograms) – An instance of a temporal network.
  • t_run_total (float) – this is just plainly copied to the returned kwargs. If it is set to None, t_run_total will be set to temporal_network.tmax
  • dt (float) – The demanded bin size. default : 0.0
  • N_time_steps (int) – Number of time bins (use either this or dt). default : 0
  • aggregated_network (dict of tuple of int -> float, optional) – dict(edge -> similarity), if this is given, the kwargs are supposed to be for the function flockwork_P_varying_rates_neighbor_affinity, you can get this network from the aggregated_network property from the results returned by measure_group_sizes_and_durations. default : {}
  • ensure_empty_network (bool, optional) – if this is True, bins where the original network is empty (n_edges = 0) will be an artificially set high gamma with P = 0, such that nodes will lose all edges. default : False
  • use_preferential_node_selection (bool, optional) – this is just plainly copied to the returned kwargs if aggregated_network is not empty. default : False
  • verbose (bool, optional) – Be chatty.
Returns:

kwargs for the functions flockwork_P_varying_rates or flockwork_P_varying_rates_neighbor_affinity, if aggregated_network was provided

Return type:

dict

tacoma.model_conversions.estimate_flockwork_alpha_beta_args_for_single_nodes(temporal_network, estimate_for_each_time_bin=False, apply_mean_correction=False, *args, **kwargs)[source]

Bins an edge_changes instance for each dt (after each step, respectively, if N_time_steps was provided) and computes the reconnection rate alpha and disconnection rate beta from the binned edges_in and edges_out. Additionally

Parameters:
  • temporal_network (_tacoma.edge_changes, _tacoma.edge_lists, _tacoma.edge_changes_with_histograms, or _tacoma.edge_lists_with_histograms) – An instance of a temporal network.
  • t_run_total (float) – this is just plainly copied to the returned kwargs. If it is set to None, t_run_total will be set to temporal_network.tmax
  • dt (float) – The demanded bin size. default : 0.0
  • N_time_steps (int) – Number of time bins (use either this or dt). default : 0
  • aggregated_network (dict of tuple of int -> float, optional) – dict(edge -> similarity), if this is given, the kwargs are supposed to be for the function flockwork_P_varying_rates_neighbor_affinity, you can get this network from the aggregated_network property from the results returned by measure_group_sizes_and_durations. default : {}
  • ensure_empty_network (bool, optional) – if this is True, bins where the original network is empty (n_edges = 0) will be an artificially set high gamma with P = 0, such that nodes will lose all edges. default : False
  • verbose (bool, optional) – Be chatty.
Returns:

kwargs for the functions flockwork_P_varying_rates or flockwork_P_varying_rates_neighbor_affinity, if aggregated_network was provided

Return type:

dict

tacoma.model_conversions.estimate_flockwork_alpha_beta_args_for_single_nodes_randomly(temporal_network, sigma, *args, **kwargs)[source]

Bins an edge_changes instance for each dt (after each step, respectively, if N_time_steps was provided) and computes the reconnection rate alpha and disconnection rate beta from the binned edges_in and edges_out. Additionally

Parameters:
  • temporal_network (_tacoma.edge_changes, _tacoma.edge_lists, _tacoma.edge_changes_with_histograms, or _tacoma.edge_lists_with_histograms) – An instance of a temporal network.
  • t_run_total (float) – this is just plainly copied to the returned kwargs. If it is set to None, t_run_total will be set to temporal_network.tmax
  • dt (float) – The demanded bin size. default : 0.0
  • N_time_steps (int) – Number of time bins (use either this or dt). default : 0
  • aggregated_network (dict of tuple of int -> float, optional) – dict(edge -> similarity), if this is given, the kwargs are supposed to be for the function flockwork_P_varying_rates_neighbor_affinity, you can get this network from the aggregated_network property from the results returned by measure_group_sizes_and_durations. default : {}
  • ensure_empty_network (bool, optional) – if this is True, bins where the original network is empty (n_edges = 0) will be an artificially set high gamma with P = 0, such that nodes will lose all edges. default : False
  • verbose (bool, optional) – Be chatty.
Returns:

kwargs for the functions flockwork_P_varying_rates or flockwork_P_varying_rates_neighbor_affinity, if aggregated_network was provided

Return type:

dict