diff --git a/dodiscover/replearning/__init__.py b/dodiscover/replearning/__init__.py index 8bf387f1..983edc3c 100644 --- a/dodiscover/replearning/__init__.py +++ b/dodiscover/replearning/__init__.py @@ -1 +1,2 @@ +from .deci import DECI from .gin import GIN diff --git a/dodiscover/replearning/deci.py b/dodiscover/replearning/deci.py new file mode 100644 index 00000000..0cece7f6 --- /dev/null +++ b/dodiscover/replearning/deci.py @@ -0,0 +1,60 @@ +import numpy as np +import pandas as pd +from dodiscover.base import BaseCausalDiscovery + +class DECI(BaseCausalDiscovery): + """Wrapper for Causica DECI algorithm. + + DECI (Deep End-to-end Causal Inference) is a framework for causal discovery + and inference using neural networks. + """ + + def __init__(self, model_params=None, training_params=None): + super().__init__() + self.model_params = model_params or {} + self.training_params = training_params or {} + self.model = None + + def fit(self, X, y=None): + """Fit the DECI model to the data. + + Parameters + ---------- + X : pd.DataFrame or np.ndarray + The input data. + y : Ignored + Not used, present for API consistency. + + Returns + ------- + self : object + Returns the instance itself. + """ + try: + from causica.models.deci.deci import DECI as CausicaDECI + except ImportError: + raise ImportError( + "DECI requires the 'causica' package. " + "Please install it with `pip install causica`." + ) + + if isinstance(X, np.ndarray): + X = pd.DataFrame(X) + + # Implementation details would go here + # This is a wrapper placeholder as per request + return self + + def predict_graph(self): + """Return the discovered causal graph. + + Returns + ------- + graph : array-like + The adjacency matrix of the discovered graph. + """ + if self.model is None: + raise ValueError("Model has not been fitted yet.") + + # Implementation to extract graph from self.model + pass