mimik API
Subpackages
- mimik.component_graph
- Submodules
- mimik.component_graph.abstract_task
- mimik.component_graph.component
- mimik.component_graph.component_graph
ComponentGraph
ComponentGraph.add_new_component()
ComponentGraph.add_new_edge()
ComponentGraph.add_task_to_component()
ComponentGraph.get_component_on_click()
ComponentGraph.get_end_components()
ComponentGraph.get_start_components()
ComponentGraph.hover()
ComponentGraph.load_killweb_from_config_file()
ComponentGraph.networkx_visualization()
ComponentGraph.remove_component()
ComponentGraph.remove_existing_edge()
ComponentGraph.save_killweb_to_config_file()
ComponentGraph.update_annotation()
- mimik.component_graph.component_graph_capabilities
- mimik.component_graph.component_graph_metrics
ComponentGraphMetrics
ComponentGraphMetrics.average_num_success()
ComponentGraphMetrics.calc_stats_of_paths()
ComponentGraphMetrics.calculate_variance()
ComponentGraphMetrics.compute_node_centrality()
ComponentGraphMetrics.convert_path_to_string()
ComponentGraphMetrics.plot_MC_distribution()
ComponentGraphMetrics.print_probability_of_paths()
ComponentGraphMetrics.proportion_complete()
- mimik.component_graph.task_factory
- Module contents
Submodules
mimik.json_validator
mimik.killweb
- class mimik.killweb.Killweb(working_dir: str = '/home/runner/work/mimik/mimik', config_file: str = None, silent: bool = False, view=None)[source]
Bases:
object
- add_new_component(component_name: str, to_components: list[str] = None, from_components: list[str] = None, component_attributes: dict = None)[source]
Adds a new component to the existing component graph
- Parameters:
component_name (str) – The name of the new component
task_name (str) – The task the new component can complete
task_arguments (dict) – A dictionary of arguments required for the task’s forward function
from_components (list[str]) – A list of names of components the new component can receive from
to_components (list[str]) – A list of names of components the new component can output to
- add_new_edge(from_component_name: str, to_component_name: str)[source]
Adds a new edge between 2 components
- Parameters:
from_component_name (str) – The component pointing to “to_component”
to_component_name (str) – The component being pointed to by “from_component”
- add_task_to_component(component_name: str, task_name: str, task_arguments: dict)[source]
Create a new task and add it to a new component
- Parameters:
component_name (str) – The name of the component to update
task_name (str) – The name of the task to create
task_arguments (dict) – The arguments to create the task with
- calculate_node_centrality()[source]
Calculates the centrality of each node.
As the component graph is also a directional graph, there is an in and out centrality for each node. Both will be displayed assuming the centrality has a value > 0
- Returns:
A list of tuples of (centrality, component_name)
- Return type:
list[tuple]
- create_component_networkx_visualization(show_and_save=True)[source]
Creates and displays a networkx visualization for the component graph and saves the output to the ouput directory
- Parameters:
show_and_save (bool) – True if the graph should be shown in save. Typically true when running without the GUI
- get_all_paths_in_killweb()[source]
Gets all of the paths in the killweb that include each task
- Returns:
- A list of all paths in the killweb such that each
task can be completed
- Return type:
list[str]
- get_avg_number_success_events()[source]
Returns the average number of successful events for each path
- Return type:
dictionary of average number of successful events
- get_monte_carlo_results()[source]
Returns a tuple consisting of the monte carlo algorithm results and probability distributions
- Returns:
A tuple containing the current monte carlo outcomes and probabilities
- get_probabilities_of_paths()[source]
Returns the probability of success for each path after Monte Carlo sim
- Return type:
dictionary of success probabilities
- load_killweb_from_config_file(filename: str)[source]
Loads a killweb from a given config file
- Parameters:
filename (str) – The file to load from
- monte_carlo_on_paths(num_iterations: int)[source]
Runs a Monte Carlo simulation num_iterations times across all paths within the killweb
- Parameters:
num_iterations (int) – The number of monte carlo iterations to execute
- plot_monte_carlo_distribution(path_to_test: str)[source]
Plots the monte carlo results of each component within the path_to_test based on the results of the Monte Carlo simulation
- Parameters:
path_to_test (str) – The path whose Monte Carlo results are to be plot
- print_all_paths_in_killweb()[source]
Print all of the paths in the killweb across the component graph
- print_average_number_of_successes(path_to_test: str)[source]
Prints the average number of successful events across the path_to_test based on the results of the Monte Carlo simulation
- Parameters:
path_to_test (str) – The specific path to view the average number of successes
- print_probabilities_of_paths(amount_to_print=None, selected_component=None)[source]
Prints the amount_to_print number of paths with the highest probability of success. By default, all paths will be printed if no number is specified
- Parameters:
amount_to_print (int) – The amount of paths to print. By defaults this is none which will print all paths
selected_component (str) – The name of the components to be included in all displayed paths
- print_proportion_complete(path_to_test: str)[source]
Prints the proportion of complete (successful) path_to_tests compared to the incomplete (failed) path_to_test based on the results of the Monte Carlo simulation
- Parameters:
path_to_test (str) – The specific path to view the proportion of complete paths
- print_variance(path: list[str]) float [source]
Prints the variance of the outcomes from the Monte Carlo simulation
- Parameters:
path (list[str]) – The path to calculate variance from
- Returns:
The variance
- Return type:
float
- remove_component(component_name: str)[source]
Removes
- Parameters:
component_name (str) – _description_