class_docstr: Evaluate AutoGluon model performance.
  
  This analysis requires a trained classifier passed in `model` arg and uses 'val_data' dataset to assess model performance.
  
  It is assumed that the validation dataset should follow the same column names seen by the model and has not been used during the training process.
  
  Parameters
  ----------
  model: TabularPredictor, required
      fitted AutoGluon model to analyze
  val_data: pd.DataFrame, required
      validation dataset to use.
      Warning: do not use data used for training as a validation data.
      Predictions on data used by the model during training tend to be optimistic and might not generalize on unseen data.
  normalize : {'true', 'pred', 'all'}, default=None
      Normalizes confusion matrix over the true (rows), predicted (columns)
      conditions or all the population. If None, confusion matrix will not be
      normalized.
      Note: applicable only for binary and multiclass classification; ignored for regression models.
  parent: Optional[AbstractAnalysis], default = None
      parent Analysis
  children: Optional[List[AbstractAnalysis]], default None
      wrapped analyses; these will receive sampled `args` during `fit` call
  
  Examples
  --------
  >>> import autogluon.eda.analysis as eda
  >>> import autogluon.eda.visualization as viz
  >>> import autogluon.eda.auto as auto
  >>>
  >>> df_train = ...
  >>> df_test = ...
  >>> predictor = ...
  >>>
  >>> auto.analyze(model=predictor, val_data=df_test, anlz_facets=[
  >>>     eda.model.AutoGluonModelEvaluator(),
  >>> ], viz_facets=[
  >>>     viz.layouts.MarkdownSectionComponent(markdown=f'### Model Prediction for {predictor.label}'),
  >>>     viz.model.ConfusionMatrix(fig_args=dict(figsize=(3,3)), annot_kws={"size": 12}),
  >>>     viz.model.RegressionEvaluation(fig_args=dict(figsize=(6,6)), chart_args=dict(marker='o', scatter_kws={'s':5})),
  >>>     viz.layouts.MarkdownSectionComponent(markdown=f'### Feature Importance for Trained Model'),
  >>>     viz.model.FeatureImportance(show_barplots=True)
  >>> ])
class_docstr_tok: ["Evaluate","AutoGluon","model","performance",".","This","analysis","requires","a","trained","classifier","passed","in","`","model","`","arg","and","uses","'val_data","'","dataset","to","assess","model","performance",".","It","is","assumed","that","the","validation","dataset","should","follow","the","same","column","names","seen","by","the","model","and","has","not","been","used","during","the","training","process",".","Parameters","--","--","--","--","--","model",":","TabularPredictor",",","required","fitted","AutoGluon","model","to","analyze","val_data",":","pd.DataFrame",",","required","validation","dataset","to","use",".","Warning",":","do","not","use","data","used","for","training","as","a","validation","data",".","Predictions","on","data","used","by","the","model","during","training","tend","to","be","optimistic","and","might","not","generalize","on","unseen","data",".","normalize",":","{","'true","'",",","'pred","'",",","'all","'","}",",","default=None","Normalizes","confusion","matrix","over","the","true","(","rows",")",",","predicted","(","columns",")","conditions","or","all","the","population",".","If","None",",","confusion","matrix","will","not","be","normalized",".","Note",":","applicable","only","for","binary","and","multiclass","classification",";","ignored","for","regression","models",".","parent",":","Optional","[","AbstractAnalysis","]",",","default","=","None","parent","Analysis","children",":","Optional","[","List","[","AbstractAnalysis","]","]",",","default","None","wrapped","analyses",";","these","will","receive","sampled","`","args","`","during","`","fit","`","call","Examples","--","--","--","--",">",">",">","import","autogluon.eda.analysis","as","eda",">",">",">","import","autogluon.eda.visualization","as","viz",">",">",">","import","autogluon.eda.auto","as","auto",">",">",">",">",">",">","df_train","=","...",">",">",">","df_test","=","...",">",">",">","predictor","=","...",">",">",">",">",">",">","auto.analyze","(","model=predictor",",","val_data=df_test",",","anlz_facets=","[",">",">",">","eda.model.AutoGluonModelEvaluator","(",")",",",">",">",">","]",",","viz_facets=","[",">",">",">","viz.layouts.MarkdownSectionComponent","(","markdown=f","'","#","#","#","Model","Prediction","for","{","predictor.label","}","'",")",",",">",">",">","viz.model.ConfusionMatrix","(","fig_args=dict","(","figsize=","(","3,3",")",")",",","annot_kws=","{","``","size","''",":","12","}",")",",",">",">",">","viz.model.RegressionEvaluation","(","fig_args=dict","(","figsize=","(","6,6",")",")",",","chart_args=dict","(","marker=","'","o","'",",","scatter_kws=","{","'s':5","}",")",")",",",">",">",">","viz.layouts.MarkdownSectionComponent","(","markdown=f","'","#","#","#","Feature","Importance","for","Trained","Model","'",")",",",">",">",">","viz.model.FeatureImportance","(","show_barplots=True",")",">",">",">","]",")"]
code: def _fit(
      self, state: AnalysisState, args: AnalysisState, **fit_kwargs
  ):
      predictor: TabularPredictor = args.model
      val_data = args.val_data
      problem_type = predictor.problem_type
      label = predictor.label
      y_true_val, y_pred_val, highest_error, undecided = self._predict(
          problem_type, predictor, val_data
      )
      test_data = args.test_data
      test_data_present = (
          args.test_data is not None and label in args.test_data.columns
      )
  
      y_true_test = None
      y_pred_test = None
      if test_data_present:
          test_data = args.test_data
          (
              y_true_test,
              y_pred_test,
              highest_error,
              undecided,
          ) = self._predict(problem_type, predictor, test_data)
  
      _data = test_data if test_data_present else val_data
      importance = predictor.feature_importance(
          _data.reset_index(drop=True), silent=True
      )
      leaderboard = predictor.leaderboard(_data)
  
      labels = predictor.class_labels
      s = {
          "problem_type": predictor.problem_type,
          "importance": importance,
          "leaderboard": leaderboard,
          "labels": labels,
          "y_true_val": y_true_val,
          "y_pred_val": y_pred_val,
      }
  
      try:
          y_pred_train = args.model.predict_proba_oof()
          s["y_true_train"] = args.train_data[args.label]
          s["y_pred_train"] = y_pred_train
      except AssertionError:
          # OOF is not available - don't use it
          pass
  
      if test_data_present:
          s["y_true_test"] = y_true_test
          s["y_pred_test"] = y_pred_test
  
      if undecided is not None:
          s["undecided"] = undecided
      if highest_error is not None:
          s["highest_error"] = highest_error
  
      if problem_type in [BINARY, MULTICLASS]:
          cm = confusion_matrix(
              y_true_val,
              y_pred_val,
              normalize=self.normalize,
              labels=labels,
          )
          s["confusion_matrix_normalized"] = self.normalize is not None
          s["confusion_matrix"] = cm
  
      state.model_evaluation = s
  
file_path: autogluon/eda/src/autogluon/eda/analysis/model.py
imports: from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  from sklearn.metrics import confusion_matrix
  from autogluon.core.constants import BINARY, MULTICLASS, PROBLEM_TYPES_CLASSIFICATION, PROBLEM_TYPES_REGRESSION, REGRESSION
  from autogluon.tabular import TabularPredictor
  from .base import AbstractAnalysis, AnalysisState
label_desc: Use image node_id 3 for calling the AutoGluonModelEvaluator obj's underlying member method code with example usage: obj._fit(state, args) without return types