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: Format partition vector for display. If seperator is None returns a list instead of a string.
docstr_tok: ["Format","partition","vector","for","display",".","If","seperator","is","None","returns","a","list","instead","of","a","string","."]
code: def _format_partition_vec_for_display(
      self,
      partition_vec: np.array,
      feature_name: str,
      seperator: Union[str, None] = "<br>",
  ) -> List[Union[List, str]]:
      """Format partition vector for display. If seperator is None returns a list instead of a string."""
      if feature_name == "":
          return [""]
      if not isinstance(partition_vec, np.ndarray):
          partition_vec = np.asarray(partition_vec)
  
      result = []
      if feature_name in self.encoder_mapping.keys():
          feature_map_df = self.encoder_mapping[feature_name]
          encodings = feature_map_df.iloc[:, 0]
          for lower, upper in zip(
              partition_vec[:-1], partition_vec[1:]
          ):
              if lower == partition_vec[0]:
                  values_in_range = np.where(
                      np.logical_and(
                          encodings >= lower, encodings <= upper
                      )
                  )[0]
              else:
                  values_in_range = np.where(
                      np.logical_and(
                          encodings > lower, encodings <= upper
                      )
                  )[0]
              if seperator is None:
                  result.append(
                      feature_map_df.iloc[values_in_range, 1].to_list()
                  )
              else:
                  result.append(
                      seperator.join(
                          [
                              str(x)
                              for x in feature_map_df.iloc[
                                  values_in_range, 1
                              ]
                          ]
                      )
                  )
  
      else:
          for lower, upper in zip(
              partition_vec[:-1], partition_vec[1:]
          ):
              result.append(
                  f"({format_number(lower)}, {format_number(upper)}]"
              )
          result[0] = "[" + result[0][1:]
  
      return result
  
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 5 for calling the WeakSegmentAbstract obj's underlying member method code with example usage: obj._format_partition_vec_for_display(partition_vec, feature_name, seperator) and returns: result, list