class_docstr: Abstract class with common methods to be inherited by WeakSegmentsPerformance checks.
class_docstr_tok: ["Abstract","class","with","common","methods","to","be","inherited","by","WeakSegmentsPerformance","checks","."]
docstr: Generate a uniform format check result value for the different WeakSegmentsPerformance checks.
docstr_tok: ["Generate","a","uniform","format","check","result","value","for","the","different","WeakSegmentsPerformance","checks","."]
code: def _generate_check_result_value(
      self, weak_segments_df, cat_features: List[str], avg_score: float
  ):
      """Generate a uniform format check result value for the different WeakSegmentsPerformance checks."""
      pd.set_option("mode.chained_assignment", None)
      weak_segments_output = weak_segments_df.copy()
      for idx, segment in weak_segments_df.iterrows():
          for feature in ["Feature1", "Feature2"]:
              if segment[feature] in cat_features:
                  weak_segments_output[f"{feature} Range"][
                      idx
                  ] = self._format_partition_vec_for_display(
                      segment[f"{feature} Range"],
                      segment[feature],
                      None,
                  )[
                      0
                  ]
  
      return {
          "weak_segments_list": weak_segments_output,
          "avg_score": avg_score,
      }
  
imports: import abc
  from collections import defaultdict
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  import plotly.express
  import sklearn
  from category_encoders import TargetEncoder
  from packaging import version
  from sklearn.model_selection import GridSearchCV
  from sklearn.tree import DecisionTreeRegressor
  from deepchecks import ConditionCategory, ConditionResult
  from deepchecks.tabular import Dataset
  from deepchecks.tabular.context import _DummyModel
  from deepchecks.tabular.metric_utils.scorers import DeepcheckScorer
  from deepchecks.utils.dataframes import default_fill_na_per_column_type
  from deepchecks.utils.performance.partition import DeepchecksFilter, convert_tree_leaves_into_filters, partition_numeric_feature_around_segment
  from deepchecks.utils.strings import format_number, format_percent
label_desc: Use image node_id 6 for calling the WeakSegmentAbstract obj's underlying member method code with example usage: obj._generate_check_result_value(weak_segments_df, cat_features, avg_score) and returns: dict