Skip to content

[API] Centralize common operations that are used to make Context objects initialize state for learning algos #136

@adam2392

Description

@adam2392

Currently, for algo.fit(data, context), the data is a pandas dataframe that encodes the dataset for a single domain (or a list of data frames for a multi-distribution setting) and context is a Context object that contains a WIP API to enable causal-learning.

The issue is that it is not exactly clear how we can implement the Context API such that it is modularizable across different learning algorithms. For example, this is already coming up in #129, where some of the node names were being dropped because there is no common way for Context to be used.

We should centralize an abstract BaseLearner for all classes, which maybe initializes state in some way and has a common API that users and developers can rely on. For example:

class BaseLearner:
     # main APIs
     context: Context
     init_graph: Graph
     causal_variables : Set[Node]
    
    def _initialize_learner(self, data, context):
          # which should be called for every learner inside `def fit()`.
          # maybe also handle error-checking

This is a WIP issue to make sure #129 and future PRs can proceed robustly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions