Repository: deepchecks/deepchecks

Issue:
[BUG] [CV] add label map to conditions
**Describe the bug**
Unclear what classes passed or didn't passed the condition because it uses the label id

**To Reproduce**
Steps to reproduce the behavior:
run class performance check

**Expected behavior**
have label map in the condition 
(dev comment: a bit hard to implement as a feature but as a user it was very unclear)

**Screenshots**
![Screen Shot 2022-03-30 at 16 41 16](https://user-images.githubusercontent.com/26321553/160864039-d8a4830f-1f09-4bdc-b3fa-e0377b7fcf10.png)




Discussion:
Suggestion: add both label id and label string (map) in all places where class-related displays exist (graphs, conditions, etc.)
Why do we need the map inside the condition? in the check output we need to already have the class as the name
yeah this a better solution, and easier

Resolving patch:
diff --git a/deepchecks/vision/checks/performance/class_performance.py b/deepchecks/vision/checks/performance/class_performance.py
--- a/deepchecks/vision/checks/performance/class_performance.py
+++ b/deepchecks/vision/checks/performance/class_performance.py
@@ -163,7 +163,7 @@ def condition(check_result: pd.DataFrame):
             not_passed_test = check_result.loc[check_result['Dataset'] == 'Test']
             if len(not_passed):
                 details = f'Found metrics with scores below threshold:\n' \
-                          f'{not_passed_test[["Class", "Metric", "Value"]].to_dict("records")}'
+                          f'{not_passed_test[["Class Name", "Metric", "Value"]].to_dict("records")}'
                 return ConditionResult(ConditionCategory.FAIL, details)
             return ConditionResult(ConditionCategory.PASS)
 
@@ -188,15 +188,15 @@ def condition(check_result: pd.DataFrame) -> ConditionResult:
             test_scores = check_result.loc[check_result['Dataset'] == 'Test']
             train_scores = check_result.loc[check_result['Dataset'] == 'Train']
 
-            if check_result.get('Class') is not None:
-                classes = check_result['Class'].unique()
+            if check_result.get('Class Name') is not None:
+                classes = check_result['Class Name'].unique()
             else:
                 classes = None
             explained_failures = []
             if classes is not None:
                 for class_name in classes:
-                    test_scores_class = test_scores.loc[test_scores['Class'] == class_name]
-                    train_scores_class = train_scores.loc[train_scores['Class'] == class_name]
+                    test_scores_class = test_scores.loc[test_scores['Class Name'] == class_name]
+                    train_scores_class = train_scores.loc[train_scores['Class Name'] == class_name]
                     test_scores_dict = dict(zip(test_scores_class['Metric'], test_scores_class['Value']))
                     train_scores_dict = dict(zip(train_scores_class['Metric'], train_scores_class['Value']))
                     # Calculate percentage of change from train to test
@@ -256,9 +256,8 @@ def add_condition_class_performance_imbalance_ratio_not_greater_than(
         DeepchecksValueError
             if unknown score function name were passed;
         """
-        # TODO: Redefine default scorers when making the condition work
-        # if score is None:
-        #     score = next(iter(MULTICLASS_SCORERS_NON_AVERAGE))
+        if score is None:
+            raise DeepchecksValueError('Must define "score" parameter')
 
         def condition(check_result: pd.DataFrame) -> ConditionResult:
             if score not in set(check_result['Metric']):
@@ -270,12 +269,12 @@ def condition(check_result: pd.DataFrame) -> ConditionResult:
 
                 min_value_index = data['Value'].idxmin()
                 min_row = data.loc[min_value_index]
-                min_class_name = min_row['Class']
+                min_class_name = min_row['Class Name']
                 min_value = min_row['Value']
 
                 max_value_index = data['Value'].idxmax()
                 max_row = data.loc[max_value_index]
-                max_class_name = max_row['Class']
+                max_class_name = max_row['Class Name']
                 max_value = max_row['Value']
 
                 relative_difference = abs((min_value - max_value) / max_value)


Test patch: