code: def target_analysis(
      train_data: pd.DataFrame,
      label: str,
      test_data: Optional[pd.DataFrame] = None,
      problem_type: str = "auto",
      fit_distributions: Union[bool, str, List[str]] = True,
      sample: Union[None, int, float] = DEFAULT_SAMPLE_SIZE,
      state: Union[None, dict, AnalysisState] = None,
      return_state: bool = False,
      fig_args: Optional[Dict[str, Any]] = None,
      chart_args: Optional[Dict[str, Any]] = None,
  ) -> Optional[AnalysisState]:
      """
      Target variable composite analysis.
  
      Performs the following analysis components of the label field:
       - basic summary stats
       - feature values distribution charts; adds fitted distributions for numeric targets
       - target correlations analysis; with interaction charts of target vs high-correlated features
  
      Supported `fig_args`/`chart_args` keys:
          - `correlation.<property>` - properties for correlation heatmap
          - `chart.<variable_name>.<property>` - properties for charts rendered during the analysis.
          If <variable_name> is matching `label` value, then this will modify the top chart; all other values will be affecting label/<variable_name>
          interaction charts
  
      Parameters
      ----------
      train_data: Optional[DataFrame]
          training dataset
      test_data: Optional[DataFrame], default = None
          test dataset
      label: : Optional[str]
          target variable
      problem_type: str, default = 'auto'
          problem type to use. Valid problem_type values include ['auto', 'binary', 'multiclass', 'regression', 'quantile', 'softclass']
          auto means it will be Auto-detected using AutoGluon methods.
      fit_distributions: Union[bool, str, List[str]], default = False,
          If `True`, or list of distributions is provided, then fit distributions. Performed only if `y` and `hue` are not present.
      state: Union[None, dict, AnalysisState], default = None
          pass prior state if necessary; the object will be updated during `anlz_facets` `fit` call.
      sample: Union[None, int, float], default = 10000
          sample size; if `int`, then row number is used;
          `float` must be between 0.0 and 1.0 and represents fraction of dataset to sample;
          `None` means no sampling
          See also :func:`autogluon.eda.analysis.dataset.Sampler`
      return_state: bool, default = False
          return state if `True`
      fig_args: Optional[Dict[str, Any]], default = None,
          figures args for visualizations; key == component; value = dict of kwargs for component figure. The args are supporting nested
          dot syntax: 'a.b.c'. Charts args are following the convention of `<variable_name>.<param>`
          (i.e. `chart.PassengerId.figsize` will result in setting `figsize` on `<target>`/`PassengerId` figure.
      chart_args: Optional[Dict[str, Any]], default = None,
          figures args for visualizations; key == component; value = dict of kwargs for component chart. The args are supporting nested
          dot syntax: 'a.b.c'. Charts args are following the convention of `<variable_name>.<param>`
          (i.e. `chart.PassengerId.fill` will result in setting `fill` on `<target>`/`PassengerId` chart.
  
      Returns
      -------
      state after `fit` call if `return_state` is `True`; `None` otherwise
  
      Examples
      --------
      >>> import autogluon.eda.analysis as eda
      >>>
      >>> auto.target_analysis(train_data=..., label=...)
  
      """
  
      assert (
          label in train_data.columns
      ), f"label `{label}` is not in `train_data` columns: `{train_data.columns}`"
  
      fig_args = expand_nested_args_into_nested_maps(
          get_empty_dict_if_none(fig_args)
      )
      chart_args = expand_nested_args_into_nested_maps(
          get_empty_dict_if_none(chart_args)
      )
  
      if (test_data is not None) and (label in test_data.columns):
          _test_data = test_data[[label]]
      else:
          _test_data = None
  
      # Basic variable information table
      state: AnalysisState = analyze(  # type: ignore # state is always present
          train_data=train_data[[label]],
          test_data=_test_data,
          label=label,
          state=state,
          sample=sample,
          return_state=True,
          anlz_facets=[
              DatasetSummary(),
              MissingValuesAnalysis(),
              RawTypesAnalysis(),
              SpecialTypesAnalysis(),
              ProblemTypeControl(problem_type=problem_type),
              LabelInsightsAnalysis(),
          ],
          viz_facets=[
              MarkdownSectionComponent("## Target variable analysis"),
              MarkdownSectionComponent(
                  "### Label Insights",
                  condition_fn=(
                      lambda s: is_key_present_in_state(
                          s, "label_insights"
                      )
                  ),
              ),
              LabelInsightsVisualization(),
              DatasetStatistics(),
          ],
      )
  
      # Distribution chart
      state = analyze_interaction(
          train_data=train_data,
          sample=sample,
          x=label,
          state=state,
          return_state=True,
          fit_distributions=fit_distributions,
          fig_args=fig_args.get("chart", {}).get(label, {}),
          chart_args=chart_args.get("chart", {}).get(label, {}),
      )
  
      state = _render_distribution_fit_information_if_available(
          state, label
      )
      state = _render_correlation_analysis(
          state, train_data, label, sample, fig_args, chart_args
      )
      state = _render_features_highly_correlated_with_target(
          state, train_data, label, sample, fig_args, chart_args
      )
  
      return state if return_state else None
  
imports: import logging
  from typing import Any, Dict, List, Optional, Tuple, Union
  import pandas
  from autogluon.common.utils.log_utils import verbosity2loglevel
  from autogluon.features import CategoryFeatureGenerator
  from autogluon.tabular import TabularPredictor
  from ..None import AnalysisState
  from ..analysis import AnomalyDetectorAnalysis, ApplyFeatureGenerator, AutoGluonModelEvaluator, AutoGluonModelQuickFit, Correlation, DistributionFit, FeatureInteraction, MissingValuesAnalysis, ProblemTypeControl, ShapAnalysis, TrainValidationSplit, XShiftDetector
  from ..analysis.base import AbstractAnalysis, BaseAnalysis, SaveArgsToState
  from ..analysis.dataset import DatasetSummary, LabelInsightsAnalysis, RawTypesAnalysis, Sampler, SpecialTypesAnalysis, VariableTypeAnalysis
  from ..analysis.interaction import FeatureDistanceAnalysis
  from ..state import is_key_present_in_state
  from ..utils.common import expand_nested_args_into_nested_maps, get_empty_dict_if_none
  from ..utils.defaults import QuickFitDefaults
  from ..visualization import AnomalyScoresVisualization, ConfusionMatrix, CorrelationVisualization, DatasetStatistics, DatasetTypeMismatch, ExplainForcePlot, ExplainWaterfallPlot, FeatureImportance, FeatureInteractionVisualization, LabelInsightsVisualization, MarkdownSectionComponent, MissingValues, ModelLeaderboard, PropertyRendererComponent, RegressionEvaluation, XShiftSummary
  from ..visualization.base import AbstractVisualization
  from ..visualization.interaction import FeatureDistanceAnalysisVisualization, PDPInteractions
  from ..visualization.layouts import SimpleVerticalLinearLayout
label_desc: Use image node_id 9 for calling a global function with example usage: target_analysis(train_data, label, test_data, problem_type, fit_distributions, sample, state, return_state, fig_args, chart_args) and returns: unknown