ETIA.CausalLearning.algorithms.tigramite_algorithm package

Submodules

ETIA.CausalLearning.algorithms.tigramite_algorithm.TigramiteAlgorithm module

class TigramiteAlgorithm(algorithm, verbose=False)[source]

Bases: object

A class that implements causal discovery using the Tigramite library.

init_algo(data_info)[source]

Initializes the algorithm with the data type and time information.

prepare_data(Data, parameters)[source]

Prepares the dataset for Tigramite algorithms.

_ci_test(parameters)[source]

Configures the conditional independence test to be used in the algorithm.

_algo(dataframe_, parameters, ci_test)[source]

Configures and runs the selected causal discovery algorithm.

output_to_array(output)[source]

Converts the Tigramite graph output into a numpy array representation.

run(data, parameters, prepare_data=True)[source]

Runs the specified Tigramite algorithm on the provided data.

init_algo(data_info)[source]

Initializes the algorithm with data type and time lag information.

Parameters:

data_info (dict) – Dictionary containing the data type information and time lag details.

prepare_data(Data, parameters)[source]

Prepares the dataset for use in the Tigramite algorithm.

Parameters:
  • Data (object) – The dataset to be prepared.

  • parameters (dict) – Additional parameters for data preparation.

Returns:

Prepared dataset in Tigramite format.

Return type:

pd.DataFrame

output_to_array(output)[source]

Converts the Tigramite graph output to a numpy array representation.

Parameters:

output (dict) – The output of the Tigramite algorithm containing the graph.

Returns:

A pandas DataFrame representing the adjacency matrix of the learned graph.

Return type:

pd.DataFrame

run(data, parameters, prepare_data=True)[source]

Runs the Tigramite algorithm on the provided data.

Parameters:
  • data (object) – The dataset to be used in the algorithm.

  • parameters (dict) – The parameters for the algorithm (e.g., significance level, ci_test).

  • prepare_data (bool, optional) – If True, prepares the data before running the algorithm. Default is True.

Returns:

A tuple containing the learned graph and a dictionary of results.

Return type:

tuple