-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python] improved sklearn interface #870
Changes from 5 commits
6cb1675
62a0ac0
1b9d998
2e63c64
be18b2b
86f7e0b
04e7d23
a3b6bd8
1ea5d2d
5732811
d571945
7873e61
cff8b65
a24dd78
fae2014
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,23 +64,38 @@ class DataFrame(object): | |
from sklearn.base import RegressorMixin, ClassifierMixin | ||
from sklearn.preprocessing import LabelEncoder | ||
from sklearn.utils import deprecated | ||
from sklearn.utils.multiclass import check_classification_targets | ||
from sklearn.utils.validation import check_X_y, check_array, check_consistent_length | ||
try: | ||
from sklearn.model_selection import StratifiedKFold, GroupKFold | ||
from sklearn.exceptions import NotFittedError | ||
except ImportError: | ||
from sklearn.cross_validation import StratifiedKFold, GroupKFold | ||
from sklearn.utils.validation import NotFittedError | ||
SKLEARN_INSTALLED = True | ||
LGBMModelBase = BaseEstimator | ||
LGBMRegressorBase = RegressorMixin | ||
LGBMClassifierBase = ClassifierMixin | ||
LGBMLabelEncoder = LabelEncoder | ||
LGBMDeprecated = deprecated | ||
LGBMNotFittedError = NotFittedError | ||
LGBMStratifiedKFold = StratifiedKFold | ||
LGBMGroupKFold = GroupKFold | ||
LGBMCheckXY = check_X_y | ||
LGBMCheckArray = check_array | ||
LGBMCheckConsistentLength = check_consistent_length | ||
LGBMCheckClassificationTargets = check_classification_targets | ||
except ImportError: | ||
SKLEARN_INSTALLED = False | ||
LGBMModelBase = object | ||
LGBMClassifierBase = object | ||
LGBMRegressorBase = object | ||
LGBMLabelEncoder = None | ||
LGBMDeprecated = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember this will raise an error if sklearn not installed, check #221. You can uninstall scikit-learn and take a try. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that it's just forgotten object. Sorry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe some of these I don't need to specify too?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I uninstalled skikit-learn, removed the line |
||
LGBMNotFittedError = ValueError | ||
LGBMStratifiedKFold = None | ||
LGBMGroupKFold = None | ||
LGBMCheckXY = None | ||
LGBMCheckArray = None | ||
LGBMCheckConsistentLength = None | ||
LGBMCheckClassificationTargets = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you install nose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sklearn's checks require
nose
. Without it new integration test fails.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh..., I got it.