Modules¶
Learn¶
Classify¶
Design¶
Predict¶
-
class
caspo.predict.
Predictor
(networks, setup)¶ Predictor of all possible experimental conditions over a given experimental setup using a given list of logical networks.
Parameters: - networks (
caspo.core.logicalnetwork.LogicalNetworkList
) – The list of logical networks used to generate the ensemble of predictions - setup (
caspo.core.setup.Setup
) – The experimental setup to generate possible experimental conditions
-
networks
¶ Type: caspo.core.logicalnetwork.LogicalNetworkList
-
setup
¶ Type: caspo.core.setup.Setup
-
predict
()¶ Computes all possible weighted average predictions and their variances
Example:
>>> from caspo import core, predict >>> networks = core.LogicalNetworkList.from_csv('behaviors.csv') >>> setup = core.Setup.from_json('setup.json') >>> predictor = predict.Predictor(networks, setup) >>> df = predictor.predict() >>> df.to_csv('predictions.csv'), index=False)
Returns: DataFrame with the weighted average predictions and variance of all readouts for each possible clamping Return type: pandas.DataFrame
- networks (
Control¶
Visualize¶
-
caspo.visualize.
behaviors_distribution
(df, filepath=None)¶ Plots the distribution of logical networks across input-output behaviors. Optionally, input-output behaviors can be grouped by MSE.
Parameters: - df (pandas.DataFrame) – DataFrame with columns networks and optionally mse
- filepath (str) – Absolute path to a folder where to write the plot
Returns: Generated plot
Return type: plot
-
caspo.visualize.
coloured_network
(network, setup, filename)¶ Plots a coloured (hyper-)graph to a dot file
Parameters: - network (object) – An object implementing a method __plot__ which must return the networkx.MultiDiGraph instance to be coloured.
Typically, it will be an instance of either
caspo.core.graph.Graph
,caspo.core.logicalnetwork.LogicalNetwork
orcaspo.core.logicalnetwork.LogicalNetworkList
- setup (
caspo.core.setup.Setup
) – Experimental setup to be coloured in the network
- network (object) – An object implementing a method __plot__ which must return the networkx.MultiDiGraph instance to be coloured.
Typically, it will be an instance of either
-
caspo.visualize.
differences_distribution
(df, filepath=None)¶ For each experimental design it plot all the corresponding generated differences in different plots
Parameters: - df (pandas.DataFrame) – DataFrame with columns id, pairs, and starting with DIF:
- filepath (str) – Absolute path to a folder where to write the plots
Returns: Generated plots
Return type: list
-
caspo.visualize.
experimental_designs
(df, filepath=None)¶ For each experimental design it plot all the corresponding experimental conditions in a different plot
Parameters: - df (pandas.DataFrame) – DataFrame with columns id and starting with TR:
- filepath (str) – Absolute path to a folder where to write the plot
Returns: Generated plots
Return type: list
-
caspo.visualize.
intervention_strategies
(df, filepath=None)¶ Plots all intervention strategies
Parameters: - df (pandas.DataFrame) – DataFrame with columns starting with TR:
- filepath (str) – Absolute path to a folder where to write the plot
Returns: Generated plot
Return type: plot
-
caspo.visualize.
interventions_frequency
(df, filepath=None)¶ Plots the frequency of occurrence for each intervention
Parameters: - df (pandas.DataFrame) – DataFrame with columns frequency and intervention
- filepath (str) – Absolute path to a folder where to write the plot
Returns: Generated plot
Return type: plot
-
caspo.visualize.
mappings_frequency
(df, filepath=None)¶ Plots the frequency of logical conjunction mappings
Parameters: - df (pandas.DataFrame) – DataFrame with columns frequency and mapping
- filepath (str) – Absolute path to a folder where to write the plot
Returns: Generated plot
Return type: plot
-
caspo.visualize.
networks_distribution
(df, filepath=None)¶ Generates two alternative plots describing the distribution of variables mse and size. It is intended to be used over a list of logical networks.
Parameters: - df (pandas.DataFrame) – DataFrame with columns mse and size
- filepath (str) – Absolute path to a folder where to write the plots
Returns: Generated plots
Return type: tuple
-
caspo.visualize.
predictions_variance
(df, filepath=None)¶ Plots the mean variance prediction for each readout
Parameters: - df (pandas.DataFrame) – DataFrame with columns starting with VAR:
- filepath (str) – Absolute path to a folder where to write the plots
Returns: Generated plot
Return type: plot