scikit-learn-contrib / boruta_py

Python implementations of the Boruta all-relevant feature selection method.
BSD 3-Clause "New" or "Revised" License
1.5k stars 256 forks source link

explicitly converted error message to string #32

Closed tagomatech closed 6 years ago

tagomatech commented 6 years ago

Python 3.5 -- Explicitly converted error message to string in the definition of the _get_imp() function, otherwise a type error is raised (TypeError: Can't convert 'ValueError' object to str implicitly). See str(e) below:

    def _get_imp(self, X, y):
        try:
            self.estimator.fit(X, y)
        except Exception as e:
            raise ValueError('Please check your X and y variable. The provided'
                             'estimator cannot be fitted to your data.\n' + str(e))
        try:
            imp = self.estimator.feature_importances_
        except Exception:
            raise ValueError('Only methods with feature_importance_ attribute '
                             'are currently supported in BorutaPy.')
        return imp
danielhomola commented 6 years ago

thanks!