module documentation
This module contains methods to initialize and compute metrics for a scale free simulation.
| Function | build |
Organizes buyers and communities into a scale free network structure. |
| Function | get |
Computes the normalization factor of the dictionary's values. |
| Function | initialize |
Initializes a scale free network world. |
| Function | make |
Creates an information file (.csv) for this scale free experiment. |
| Function | remove |
Removes dictionary pairs with values equal to zero. |
| Function | safe |
Normalizes values in dictionary. |
def build_scale_free_network(set_of_nodes, G, community_bonus, logger, epoch, all_buyers_in_market):
¶
Organizes buyers and communities into a scale free network structure.
| Parameters | |
| set | random subset of buyers |
| G | graph representing initial market state |
| community | bonus to purchase probability from being in the same community |
| logger | logging object |
| epoch | current epoch (for logger) |
| all | list of all buyers in market |
| Returns | |
| graph representing initial market state in scale free structure | |
Computes the normalization factor of the dictionary's values.
| Parameters | |
| dictionary | input dictionary object |
| Returns | |
| normalization factor of the dictionary's values | |
def initialize_scale_free(number_of_buyers, minimum_number_of_communities, minimum_community_fill, assemblage, initial_set_size, community_bonus, logger):
¶
Initializes a scale free network world.
| Parameters | |
| number | number of buyers in marketspace |
| minimum | minimum number of communities to which buyers belong |
| minimum | minimum number of buyers per community |
| assemblage | list of items for sale in marketspace |
| initial | number of buyers in market at initialization |
| community | degree to which community affiliation impacts purchase intention |
| logger | logging object |
def make_sf_graph_info_file(num_buyers, min_num_communities, min_community_fill, assemblage, epochs, upper_thresh, lower_thresh, death_thresh, results_dir, community_bonus, initial_set_size, set_size):
¶
Creates an information file (.csv) for this scale free experiment.
| Parameters | |
| num | number of buyers in market |
| min | minimum number of communities |
| min | minimum number of buyers per community |
| assemblage | list of items for sale in market |
| epochs | number of market iterations |
| upper | % of buyers that must own a particular item to change a buyer's intention to that item |
| lower | max % of buyers that may own a particular item to change a buyer's intention to random item |
| death | percentage at which a pot is removed from the market |
| results | directory path in which to store the file |
| community | degree to which community affiliation impacts purchase intention |
| initial | number of buyers in market at initialization |
| set | number of buyers added to market after initialization |
Removes dictionary pairs with values equal to zero.
| Parameters | |
| dictionary | input dictionary object |
| Returns | |
| dictionary with zero value pairs removed | |