class_docstr: Base class for all sklearn wrappers of the StructureModel.
  Implements the sklearn .fit and .predict interface.
class_docstr_tok: ["Base","class","for","all","sklearn","wrappers","of","the","StructureModel",".","Implements","the","sklearn",".fit","and",".predict","interface","."]
docstr: Args:
      dist_type_schema: The dist type schema corresponding to the X data passed to fit or predict.
      It maps the pandas column name in X to the string alias of a dist type.
      If X is a np.ndarray, it maps the positional index to the string alias of a dist type.
      A list of alias names can be found in ``dist_type/__init__.py``.
      If None, assumes that all data in X is continuous.
  
      alpha: l1 loss weighting. When using nonlinear layers this is only applied
      to the first layer.
  
      beta: l2 loss weighting. Applied across all layers. Reccomended to use this
      when fitting nonlinearities.
  
      fit_intercept: Whether to fit an intercept in the structure model
      equation. Use this if variables are offset.
  
      hidden_layer_units: An iterable where its length determine the number of layers used,
      and the numbers determine the number of nodes used for the layer in order.
  
      threshold: The thresholding to apply to the DAG weights.
      If 0.0, does not apply any threshold.
  
      tabu_edges: Tabu edges passed directly to the NOTEARS algorithm.
  
      tabu_parent_nodes: Tabu nodes passed directly to the NOTEARS algorithm.
  
      tabu_child_nodes: Tabu nodes passed directly to the NOTEARS algorithm.
  
      dependent_target: If True, constrains NOTEARS so that y can only
      be dependent (i.e. cannot have children) and imputes from parent nodes.
  
      enforce_dag: If True, thresholds the graph until it is a DAG.
      NOTE a properly trained model should be a DAG, and failure
      indicates other issues. Use of this is only recommended if
      features have similar units, otherwise comparing edge weight
      magnitude has limited meaning.
  
      standardize: Whether to standardize the X and y variables before fitting.
      The L-BFGS algorithm used to fit the underlying NOTEARS works best on data
      all of the same scale so this parameter is reccomended.
  
      notears_mlp_kwargs: Additional arguments for the NOTEARS MLP model.
  
      target_dist_type: The distribution type of the target.
      Uses the same aliases as dist_type_schema.
  
  Raises:
      TypeError: if alpha is not numeric.
      TypeError: if beta is not numeric.
      TypeError: if fit_intercept is not a bool.
      TypeError: if threshold is not numeric.
      NotImplementedError: if target_dist_type not in supported_types
docstr_tok: ["Args",":","dist_type_schema",":","The","dist","type","schema","corresponding","to","the","X","data","passed","to","fit","or","predict",".","It","maps","the","pandas","column","name","in","X","to","the","string","alias","of","a","dist","type",".","If","X","is","a","np.ndarray",",","it","maps","the","positional","index","to","the","string","alias","of","a","dist","type",".","A","list","of","alias","names","can","be","found","in","``","dist_type\/__init__.py","``",".","If","None",",","assumes","that","all","data","in","X","is","continuous",".","alpha",":","l1","loss","weighting",".","When","using","nonlinear","layers","this","is","only","applied","to","the","first","layer",".","beta",":","l2","loss","weighting",".","Applied","across","all","layers",".","Reccomended","to","use","this","when","fitting","nonlinearities",".","fit_intercept",":","Whether","to","fit","an","intercept","in","the","structure","model","equation",".","Use","this","if","variables","are","offset",".","hidden_layer_units",":","An","iterable","where","its","length","determine","the","number","of","layers","used",",","and","the","numbers","determine","the","number","of","nodes","used","for","the","layer","in","order",".","threshold",":","The","thresholding","to","apply","to","the","DAG","weights",".","If","0.0",",","does","not","apply","any","threshold",".","tabu_edges",":","Tabu","edges","passed","directly","to","the","NOTEARS","algorithm",".","tabu_parent_nodes",":","Tabu","nodes","passed","directly","to","the","NOTEARS","algorithm",".","tabu_child_nodes",":","Tabu","nodes","passed","directly","to","the","NOTEARS","algorithm",".","dependent_target",":","If","True",",","constrains","NOTEARS","so","that","y","can","only","be","dependent","(","i.e",".","can","not","have","children",")","and","imputes","from","parent","nodes",".","enforce_dag",":","If","True",",","thresholds","the","graph","until","it","is","a","DAG",".","NOTE","a","properly","trained","model","should","be","a","DAG",",","and","failure","indicates","other","issues",".","Use","of","this","is","only","recommended","if","features","have","similar","units",",","otherwise","comparing","edge","weight","magnitude","has","limited","meaning",".","standardize",":","Whether","to","standardize","the","X","and","y","variables","before","fitting",".","The","L-BFGS","algorithm","used","to","fit","the","underlying","NOTEARS","works","best","on","data","all","of","the","same","scale","so","this","parameter","is","reccomended",".","notears_mlp_kwargs",":","Additional","arguments","for","the","NOTEARS","MLP","model",".","target_dist_type",":","The","distribution","type","of","the","target",".","Uses","the","same","aliases","as","dist_type_schema",".","Raises",":","TypeError",":","if","alpha","is","not","numeric",".","TypeError",":","if","beta","is","not","numeric",".","TypeError",":","if","fit_intercept","is","not","a","bool",".","TypeError",":","if","threshold","is","not","numeric",".","NotImplementedError",":","if","target_dist_type","not","in","supported_types"]
code: def __init__(
      self,
      dist_type_schema: Dict[Union[str, int], str] = None,
      alpha: float = 0.0,
      beta: float = 0.0,
      fit_intercept: bool = True,
      hidden_layer_units: Iterable[int] = None,
      threshold: float = 0.0,
      tabu_edges: List = None,
      tabu_parent_nodes: List = None,
      tabu_child_nodes: List = None,
      dependent_target: bool = True,
      enforce_dag: bool = False,
      standardize: bool = False,
      target_dist_type: str = None,
      notears_mlp_kwargs: Dict = None,
  ):
      """
      Args:
          dist_type_schema: The dist type schema corresponding to the X data passed to fit or predict.
          It maps the pandas column name in X to the string alias of a dist type.
          If X is a np.ndarray, it maps the positional index to the string alias of a dist type.
          A list of alias names can be found in ``dist_type/__init__.py``.
          If None, assumes that all data in X is continuous.
  
          alpha: l1 loss weighting. When using nonlinear layers this is only applied
          to the first layer.
  
          beta: l2 loss weighting. Applied across all layers. Reccomended to use this
          when fitting nonlinearities.
  
          fit_intercept: Whether to fit an intercept in the structure model
          equation. Use this if variables are offset.
  
          hidden_layer_units: An iterable where its length determine the number of layers used,
          and the numbers determine the number of nodes used for the layer in order.
  
          threshold: The thresholding to apply to the DAG weights.
          If 0.0, does not apply any threshold.
  
          tabu_edges: Tabu edges passed directly to the NOTEARS algorithm.
  
          tabu_parent_nodes: Tabu nodes passed directly to the NOTEARS algorithm.
  
          tabu_child_nodes: Tabu nodes passed directly to the NOTEARS algorithm.
  
          dependent_target: If True, constrains NOTEARS so that y can only
          be dependent (i.e. cannot have children) and imputes from parent nodes.
  
          enforce_dag: If True, thresholds the graph until it is a DAG.
          NOTE a properly trained model should be a DAG, and failure
          indicates other issues. Use of this is only recommended if
          features have similar units, otherwise comparing edge weight
          magnitude has limited meaning.
  
          standardize: Whether to standardize the X and y variables before fitting.
          The L-BFGS algorithm used to fit the underlying NOTEARS works best on data
          all of the same scale so this parameter is reccomended.
  
          notears_mlp_kwargs: Additional arguments for the NOTEARS MLP model.
  
          target_dist_type: The distribution type of the target.
          Uses the same aliases as dist_type_schema.
  
      Raises:
          TypeError: if alpha is not numeric.
          TypeError: if beta is not numeric.
          TypeError: if fit_intercept is not a bool.
          TypeError: if threshold is not numeric.
          NotImplementedError: if target_dist_type not in supported_types
      """
  
      if not isinstance(alpha, (int, float)):
          raise TypeError("alpha should be numeric")
      if not isinstance(beta, (int, float)):
          raise TypeError("beta should be numeric")
      if not isinstance(fit_intercept, bool):
          raise TypeError("fit_intercept should be a bool")
      if not isinstance(threshold, (int, float)):
          raise TypeError("threshold should be numeric")
  
      # supported types is a class attr in child class
      self._supported_types: str
  
      # defensive check
      if (target_dist_type not in self._supported_types) and (
          target_dist_type is not None
      ):
          raise NotImplementedError(
              f"Currently only implements [{', '.join(self._supported_types)}] dist types."
              f" Got: {target_dist_type}"
          )
  
      # core causalnex parameters
      self.alpha = alpha
      self.beta = beta
      self.fit_intercept = fit_intercept
      self.hidden_layer_units = hidden_layer_units
      self.dist_type_schema = dist_type_schema
      self.threshold = threshold
      self.tabu_edges = tabu_edges
      self.tabu_parent_nodes = tabu_parent_nodes
      self.tabu_child_nodes = tabu_child_nodes
      self.target_dist_type = target_dist_type
      self.notears_mlp_kwargs = notears_mlp_kwargs
  
      # sklearn wrapper paramters
      self.dependent_target = dependent_target
      self.enforce_dag = enforce_dag
      self.standardize = standardize
  
imports: import copy
  from abc import ABCMeta
  from typing import Dict, Iterable, List, Union
  import numpy
  import pandas
  from IPython.lib.display import IFrame
  from sklearn.base import BaseEstimator
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils.validation import check_is_fitted, check_X_y
  from causalnex.plots import EDGE_STYLE, NODE_STYLE, display_plot_ipython, plot_structure
  from causalnex.structure.pytorch import notears
label_desc: Use image node_id 1 to create a new DAGBase object from inherited base classes: BaseEstimator with example: obj = DAGBase(dist_type_schema, alpha, beta, fit_intercept, hidden_layer_units, threshold, tabu_edges, tabu_parent_nodes, tabu_child_nodes, dependent_target, enforce_dag, standardize, target_dist_type, notears_mlp_kwargs)