Repository: deepchecks/deepchecks

Issue:
Regression error distribution is missing the prediction column
When I look at the results of the regresssion error distribution check, I can see the features, the target, and the target-prediction difference. It would be really helpful to see also the prediction itself, since it is hard to understand the direction of the error from the wording "Largest over estimated error". Also often users skip reading large texts..

![image](https://user-images.githubusercontent.com/20860465/147751456-37bde69d-1829-4c98-9840-949a38727ed9.png)



Discussion:

Resolving patch:
diff --git a/deepchecks/checks/performance/regression_error_distribution.py b/deepchecks/checks/performance/regression_error_distribution.py
--- a/deepchecks/checks/performance/regression_error_distribution.py
+++ b/deepchecks/checks/performance/regression_error_distribution.py
@@ -23,15 +23,22 @@
 
 
 class RegressionErrorDistribution(SingleDatasetBaseCheck):
-    """Check regresstion error distribution.
+    """Check regression error distribution.
+
+    The check shows the distribution of the regression error, and enables to set conditions on the distribution
+    kurtosis. Kurtosis is a measure of the shape of the distribution, helping us understand if the distribution
+    is significantly "wider" from the normal distribution, which may imply a certain cause of error deforming the
+    normal shape.
 
     Args:
-        n_top_samples (int): amount of samples to show which are of Largest under / over estimation errors.
+        n_top_samples (int): amount of samples to show which have the largest under / over estimation errors.
+        n_bins (int): number of bins to use for the histogram.
     """
 
-    def __init__(self, n_top_samples: int = 3):
+    def __init__(self, n_top_samples: int = 3, n_bins: int = 40):
         super().__init__()
         self.n_top_samples = n_top_samples
+        self.n_bins = n_bins
 
     def run(self, dataset: Dataset, model: BaseEstimator) -> CheckResult:
         """Run check.
@@ -43,7 +50,7 @@ def run(self, dataset: Dataset, model: BaseEstimator) -> CheckResult:
         Returns:
            CheckResult:
                 - value is the kurtosis value (Fisher’s definition (normal ==> 0.0)).
-                - display is histogram of error distirbution and the largest prediction errors.
+                - display is histogram of error distribution and the largest prediction errors.
 
         Raises:
             DeepchecksValueError: If the object is not a Dataset instance with a label
@@ -57,22 +64,25 @@ def _regression_error_distribution(self, dataset: Dataset, model: BaseEstimator)
 
         y_test = dataset.label_col
         y_pred = model.predict(dataset.features_columns)
+        y_pred = pd.Series(y_pred, name='predicted ' + str(dataset.label_name), index=dataset.label_col.index)
 
         diff = y_test - y_pred
         kurtosis_value = kurtosis(diff)
 
         n_largest_diff = diff.nlargest(self.n_top_samples)
-        n_largest_diff.name = n_largest_diff.name + ' Prediction Difference'
-        n_largest = pd.concat([dataset.data.loc[n_largest_diff.index], n_largest_diff], axis=1)
+        n_largest_diff.name = str(dataset.label_name) + ' Prediction Difference'
+        n_largest = pd.concat([dataset.data.loc[n_largest_diff.index], y_pred.loc[n_largest_diff.index],
+                               n_largest_diff], axis=1)
 
         n_smallest_diff = diff.nsmallest(self.n_top_samples)
-        n_smallest_diff.name = n_smallest_diff.name + ' Prediction Difference'
-        n_smallest = pd.concat([dataset.data.loc[n_smallest_diff.index], n_smallest_diff], axis=1)
+        n_smallest_diff.name = str(dataset.label_name) + ' Prediction Difference'
+        n_smallest = pd.concat([dataset.data.loc[n_smallest_diff.index], y_pred.loc[n_smallest_diff.index],
+                                n_smallest_diff], axis=1)
 
         display = [
             px.histogram(
                 x=diff.values,
-                nbins=40,
+                nbins=self.n_bins,
                 title='Histogram of prediction errors',
                 labels={'x': f'{dataset.label_name} prediction error', 'y': 'Count'},
                 width=700, height=500
diff --git a/deepchecks/utils/metrics.py b/deepchecks/utils/metrics.py
--- a/deepchecks/utils/metrics.py
+++ b/deepchecks/utils/metrics.py
@@ -35,7 +35,8 @@
     'MULTICLASS_SCORERS_NON_AVERAGE',
     'get_scores_ratio',
     'initialize_multi_scorers',
-    'get_scorer_single'
+    'get_scorer_single',
+    'task_type_validation'
 ]
 
 from deepchecks.utils.strings import is_string_column


Test patch: