openasce.discovery.regression_discovery package¶
Submodules¶
openasce.discovery.regression_discovery.lbfgsb_optimizer module¶
openasce.discovery.regression_discovery.locally_connected module¶
- class openasce.discovery.regression_discovery.locally_connected.LocallyConnected(num_linear, input_features, output_features, bias=True)[source]¶
Bases:
ModuleLocal linear layer
- Argument:
num_linear: num of local linear layers, i.e. in_features: m1 out_features: m2 bias: whether to include bias or not
- Shape:
Input: [n, d, m1]
Output: [n, d, m2]
- weight¶
[d, m1, m2]
- bias¶
[d, m2]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- __init__(num_linear, input_features, output_features, bias=True)[source]¶
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(input: Tensor)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openasce.discovery.regression_discovery.notears_mlp module¶
- class openasce.discovery.regression_discovery.notears_mlp.NotearsMLP(dims, bias=True)[source]¶
Bases:
ModuleInitializes internal Module state, shared by both nn.Module and ScriptModule.
- __init__(dims, bias=True)[source]¶
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
openasce.discovery.regression_discovery.regression_discovery module¶
- class openasce.discovery.regression_discovery.regression_discovery.CausalRegressionDiscovery[source]¶
Bases:
DiscoveryExecute the causal discovery by notears method
Attributes:
Constructor
Arguments:
Returns:
- fit(*, X: Union[ndarray, Callable], **kwargs)[source]¶
Feed the sample data
- Parameters
X (num of samples, features or callable returning np.ndarray) – samples
Returns:
- get_result() Tuple[CausalGraph, float][source]¶
Get the causal graph sample data
- Parameters
X (num of samples, features or callable returning np.ndarray) – samples
Returns:
openasce.discovery.regression_discovery.regression_strategy module¶
- class openasce.discovery.regression_discovery.regression_strategy.Strategy(node_names: List[str], **kwargs)[source]¶
Bases:
objectGeneral class to implement different structure learning methods
Attributes
Contructor
- Parameters
node_names – the name of nodes
- __init__(node_names: List[str], **kwargs)[source]¶
Contructor
- Parameters
node_names – the name of nodes
- dual_ascent(model, X, lambda1, lambda2, rho_max, rho, alpha, h)[source]¶
Perform one step of dual ascent in augmented Lagrangian.
- run(*, model: Module, data: ndarray, max_iteration: int = 3, lambda1: float = 0.1, lambda2: float = 0.1, h_tol: float = 1e-08, rho_max: float = 1e+16, w_threshold: float = 0.3, **kwargs) Tuple[source]¶
Run the actual strategy
- Parameters
model – the model used to discover the better graph
data – the features of samples
**kwargs (dict) – dictionnary with method specific args
Returns: