class_docstr: The `ConfusionBalancer` estimator attempts to give it's child estimator a more balanced output by learning from
  the confusion matrix during training.
  
  The idea is that the confusion matrix calculates $P(C_i | M_i)$ where $C_i$ is the actual class and $M_i$ is the
  class that the underlying model gives. We use these probabilities to attempt a more balanced prediction by averaging
  the correction from the confusion matrix with the original probabilities.
  
  $$P(\text{class}_j) = \alpha P(\text{model}_j) + (1-\alpha) P(\text{class}_j | \text{model}_j) P(\text{model}_j)$$
  
  Parameters
  ----------
  estimator : scikit-learn compatible classifier
      The estimator to be wrapped, it must implement a `predict_proba` method.
  alpha : float, default=0.5
      Hyperparameter which determines how much smoothing to apply. Must be between 0 and 1.
  cfm_smooth : float, default=0
      Smoothing parameter for the confusion matrices to ensure zeros don't exist.
  
  Attributes
  ----------
  classes_ : array-like of shape (n_classes,)
      The target class labels.
  cfm_ : array-like of shape (n_classes, n_classes)
      The confusion matrix used for the correction.
class_docstr_tok: ["The","`","ConfusionBalancer","`","estimator","attempts","to","give","it","'s","child","estimator","a","more","balanced","output","by","learning","from","the","confusion","matrix","during","training",".","The","idea","is","that","the","confusion","matrix","calculates","$","P","(","C_i","|","M_i",")","$","where","$","C_i","$","is","the","actual","class","and","$","M_i","$","is","the","class","that","the","underlying","model","gives",".","We","use","these","probabilities","to","attempt","a","more","balanced","prediction","by","averaging","the","correction","from","the","confusion","matrix","with","the","original","probabilities",".","$","$","P","(","\\text","{","class","}","_j",")","=","\\alpha","P","(","\\text","{","model","}","_j",")","+","(","1-\\alpha",")","P","(","\\text","{","class","}","_j","|","\\text","{","model","}","_j",")","P","(","\\text","{","model","}","_j",")","$","$","Parameters","--","--","--","--","--","estimator",":","scikit-learn","compatible","classifier","The","estimator","to","be","wrapped",",","it","must","implement","a","`","predict_proba","`","method",".","alpha",":","float",",","default=0.5","Hyperparameter","which","determines","how","much","smoothing","to","apply",".","Must","be","between","0","and","1.","cfm_smooth",":","float",",","default=0","Smoothing","parameter","for","the","confusion","matrices","to","ensure","zeros","do","n't","exist",".","Attributes","--","--","--","--","--","classes_",":","array-like","of","shape","(","n_classes",",",")","The","target","class","labels",".","cfm_",":","array-like","of","shape","(","n_classes",",","n_classes",")","The","confusion","matrix","used","for","the","correction","."]
docstr: Predict probabilities for new data `X` using the underlying estimator and then applying the confusion matrix
  correction.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      The data to predict.
  
  Returns
  -------
  array-like of shape (n_samples, n_classes)
      The predicted values.
docstr_tok: ["Predict","probabilities","for","new","data","`","X","`","using","the","underlying","estimator","and","then","applying","the","confusion","matrix","correction",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","The","data","to","predict",".","Returns","--","--","--","-","array-like","of","shape","(","n_samples",",","n_classes",")","The","predicted","values","."]
code: def predict_proba(self, X):
      """Predict probabilities for new data `X` using the underlying estimator and then applying the confusion matrix
      correction.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          The data to predict.
  
      Returns
      -------
      array-like of shape (n_samples, n_classes)
          The predicted values.
      """
      X = check_array(X, estimator=self, dtype=FLOAT_DTYPES)
      preds = self.estimator.predict_proba(X)
      return (1 - self.alpha) * preds + self.alpha * preds @ self.cfm_
  
file_path: scikit-lego/sklego/meta/confusion_balancer.py
imports: from sklearn.base import BaseEstimator, ClassifierMixin, MetaEstimatorMixin
  from sklearn.metrics import confusion_matrix
  from sklearn.utils.multiclass import unique_labels
  from sklearn.utils.validation import FLOAT_DTYPES, check_array, check_is_fitted, check_X_y
  from sklego.base import ProbabilisticClassifier
label_desc: Use image node_id 3 for calling the ConfusionBalancer obj's underlying member method code with example usage: obj.predict_proba(X) and returns: unknown