class_docstr: Summary class for logging and storing information of the auto assignment process.
class_docstr_tok: ["Summary","class","for","logging","and","storing","information","of","the","auto","assignment","process","."]
code: def __str__(self):
      summary_strings = []
  
      summary_strings.append(
          "When using this auto assignment function, the given data is used to automatically assign a causal "
          "mechanism to each node. Note that causal mechanisms can also be customized and assigned manually.\n"
          "The following types of causal mechanisms are considered for the automatic selection:"
      )
      summary_strings.append("\nIf root node:")
      summary_strings.append(
          "An empirical distribution, i.e., the distribution is represented by randomly sampling from the provided "
          "data. This provides a flexible and non-parametric way to model the marginal distribution and is valid for "
          "all types of data modalities."
      )
      summary_strings.append(
          "\nIf non-root node and the data is continuous:"
      )
      summary_strings.append(
          "Additive Noise Models (ANM) of the form X_i = f(PA_i) + N_i, where PA_i are the "
          "parents of X_i and the unobserved noise N_i is assumed to be independent of PA_i."
          "To select the best model for f, different regression models are evaluated and the model "
          "with the smallest mean squared error is selected."
          "Note that minimizing the mean squared error here is equivalent to selecting the best "
          "choice of an ANM."
      )
      summary_strings.append(
          "\nIf non-root node and the data is discrete:"
      )
      summary_strings.append(
          "Discrete Additive Noise Models have almost the same definition as non-discrete ANMs, but come with an "
          "additional constraint for f to only return discrete values.\n"
          "Note that 'discrete' here refers to numerical values with an order. If the data is categorical, consider "
          "representing them as strings to ensure proper model selection."
      )
      summary_strings.append(
          "\nIf non-root node and the data is categorical:"
      )
      summary_strings.append(
          "A functional causal model based on a classifier, i.e., X_i = f(PA_i, N_i).\n"
          "Here, N_i follows a uniform distribution on [0, 1] and is used to randomly sample a "
          "class (category) using the conditional probability distribution produced by a "
          "classification model."
          "Here, different model classes are evaluated using the (negative) F1 score and the best"
          " performing model class is selected."
      )
      summary_strings.append(
          "\nIn total, %d nodes were analyzed:" % len(list(self._nodes))
      )
  
      for node in self._nodes:
          summary_strings.append("\n--- Node: %s" % node)
          summary_strings.extend(self._nodes[node]["messages"])
  
          if len(self._nodes[node]["model_performances"]) > 0:
              summary_strings.append(
                  "For the model selection, the following models were evaluated on the %s metric:"
                  % self._nodes[node]["model_performances"][0][2]
              )
  
              for model, performance, metric_name in self._nodes[node][
                  "model_performances"
              ]:
                  summary_strings.append(
                      "%s: %s"
                      % (
                          str(model()).replace("()", ""),
                          str(performance),
                      )
                  )
  
      summary_strings.append(
          "\n===Note===\nNote, based on the selected auto assignment quality, the set of "
          "evaluated models changes."
      )
      summary_strings.append(
          "For more insights toward the quality of the fitted graphical causal model, consider "
          "using the evaluate_causal_model function after fitting the causal mechanisms."
      )
      return "\n".join(summary_strings)
  
imports: import warnings
  from enum import Enum, auto
  from functools import partial
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import networkx
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from sklearn import metrics
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from sklearn.model_selection import KFold, StratifiedKFold, train_test_split
  from sklearn.preprocessing import MultiLabelBinarizer
  from dowhy.gcm import config
  from dowhy.gcm.causal_mechanisms import AdditiveNoiseModel, ClassifierFCM, DiscreteAdditiveNoiseModel
  from dowhy.gcm.causal_models import CAUSAL_MECHANISM, ProbabilisticCausalModel, validate_causal_model_assignment
  from dowhy.gcm.ml import ClassificationModel, PredictionModel, create_hist_gradient_boost_classifier, create_hist_gradient_boost_regressor, create_lasso_regressor, create_linear_regressor, create_logistic_regression_classifier, create_random_forest_regressor, create_ridge_regressor, create_support_vector_regressor
  from dowhy.gcm.ml.classification import create_ada_boost_classifier, create_extra_trees_classifier, create_gaussian_nb_classifier, create_knn_classifier, create_polynom_logistic_regression_classifier, create_random_forest_classifier, create_support_vector_classifier
  from dowhy.gcm.ml.regression import create_ada_boost_regressor, create_extra_trees_regressor, create_knn_regressor, create_polynom_regressor
  from dowhy.gcm.stochastic_models import EmpiricalDistribution
  from dowhy.gcm.util.general import auto_apply_encoders, auto_fit_encoders, is_categorical, is_discrete, set_random_seed, shape_into_2d
  from dowhy.graph import get_ordered_predecessors, is_root_node
label_desc: Use image node_id 5 for calling the AutoAssignmentSummary obj's underlying member method code with example usage: obj.__str__() and returns: str