networkcommons.eval.perform_random_controls

networkcommons.eval.perform_random_controls(graph, inference_function, n_iterations, network_name, randomise_measurements=True, item_list=None, **kwargs)

Performs random controls of a network by shuffling node labels and running the inference function.

Parameters: graph (nx.DiGraph): The original directed graph. inference_function (function): The network inference function to apply. n_iterations (int): The number of iterations to perform. network_name (str): The base name for the networks in the resulting dictionary. randomise_measurements (bool, optional): Whether to randomise the measurements. Defaults to True. Requires a target_dict in the kwargs and an item_list with the possible labels. item_list (list, optional): A dictionary containing the measurements to randomise. Defaults to None. If randomise_measurements is True, this is required. **kwargs: Additional keyword arguments to pass to the inference function.

Returns: dict: A dictionary containing the inferred networks.