diff --git a/erroranalysis/erroranalysis/analyzer/error_analyzer.py b/erroranalysis/erroranalysis/analyzer/error_analyzer.py index df87a0258c..4a40141616 100644 --- a/erroranalysis/erroranalysis/analyzer/error_analyzer.py +++ b/erroranalysis/erroranalysis/analyzer/error_analyzer.py @@ -476,12 +476,12 @@ def compute_importances(self, error_correlation_method=MUTUAL_INFO): IMPORTANCES_THRESHOLD) input_data = input_data[indexes] diff = diff[indexes] - # For numerical data types to make calculation/imputation error-free - input_data = input_data.astype(float) try: importances = self._compute_error_correlation( input_data, diff, error_correlation_method) except ValueError: + # For numerical data types to make calculation/imputation error-free + input_data = input_data.astype(float) # Impute input_data if it contains NaNs, infinity or a value too # large for dtype('float64') input_data = np.nan_to_num(input_data)