add scikit-learn v0.18 compatibility (#1636)
* add scikit-learn v0.18 compatibility import KFold & StratifiedKFold from sklearn.model_selection instead of sklearn.cross_validation * change DeprecationWarning to ImportError DeprecationWarning isn't an exception, so it should work the other way around.
This commit is contained in:
parent
a64fd74421
commit
c8ae52f17a
@ -47,7 +47,11 @@ try:
|
|||||||
from sklearn.base import BaseEstimator
|
from sklearn.base import BaseEstimator
|
||||||
from sklearn.base import RegressorMixin, ClassifierMixin
|
from sklearn.base import RegressorMixin, ClassifierMixin
|
||||||
from sklearn.preprocessing import LabelEncoder # noqa
|
from sklearn.preprocessing import LabelEncoder # noqa
|
||||||
|
try:
|
||||||
|
from sklearn.model_selection import KFold, StratifiedKFold
|
||||||
|
except ImportError:
|
||||||
from sklearn.cross_validation import KFold, StratifiedKFold
|
from sklearn.cross_validation import KFold, StratifiedKFold
|
||||||
|
|
||||||
SKLEARN_INSTALLED = True
|
SKLEARN_INSTALLED = True
|
||||||
|
|
||||||
XGBModelBase = BaseEstimator
|
XGBModelBase = BaseEstimator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user