jpt.learning.dependency.base

Abstract base class for dependency discovery.

Defines the contract that all dependency discovery strategies must satisfy: callable with a fixed signature and JSON-serializable for model persistence.

Classes

DependencyDiscovery

Abstract base class for dependency discovery.

Module Contents

class jpt.learning.dependency.base.DependencyDiscovery

Bases: abc.ABC

Abstract base class for dependency discovery.

Subclasses implement a strategy for determining which target variables depend on which features, given the training data. The result is used by the JPT learning algorithm to restrict impurity computation to dependent variable pairs.

Implementations must be serializable via to_json()/from_json() so that the discovery strategy is preserved when the JPT model is saved and loaded.

_REGISTRY: dict[str, type[DependencyDiscovery]]
classmethod __init_subclass__(**kwargs: Any) None

Auto-register subclasses for deserialization.

abstract __call__(data: numpy.ndarray, features: list[jpt.variables.Variable], targets: list[jpt.variables.Variable], variables: list[jpt.variables.Variable]) dict[jpt.variables.Variable, list[jpt.variables.Variable]]

Discover dependencies from data.

Parameters:
  • data – preprocessed data array (n_samples x n_variables)

  • features – list of feature Variables

  • targets – list of target Variables

  • variables – list of all Variables (defines column order)

Returns:

dict mapping each feature Variable to a list of dependent target Variables

abstract to_json() dict[str, Any]

Serialize the strategy configuration.

Must include a 'type' key with the class name for deserialization dispatch.

Returns:

JSON-serializable dict

classmethod from_json(data: dict[str, Any]) DependencyDiscovery | None

Deserialize a strategy from JSON.

Dispatches to the appropriate subclass based on the 'type' key.

Parameters:

data – dict from to_json()

Returns:

DependencyDiscovery instance