-
Notifications
You must be signed in to change notification settings - Fork 719
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
Improve model selection #848
Conversation
3720600
to
9f517fd
Compare
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
9f517fd
to
d6b0353
Compare
Should we add a test that sklearn pipelines work correctly? |
Good point, I'll add several tests covering this functionality. |
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
d6b0353
to
4c180f7
Compare
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
4c180f7
to
d42cb2f
Compare
scores.append(model.best_score) | ||
self._all_scores = scores | ||
self._best_score = np.max(scores) | ||
self._best_model = self.models[np.argmax(scores)] | ||
|
||
else: | ||
self._best_model.train(is_selecting, *args, **kwargs) | ||
self._best_model.train(is_selecting, folds, *args, **kwargs) |
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.
is_selecting
will be False here. Do we need to pass folds
in this case?
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.
It's academic; if is_selecting
is False then folds
will be None anyway so we could pass folds
or we could equivalently pass None
.
But I think this is slightly more robust to changes in the upstream logic, since if for some reason we ever change that invariant then the logic here might not need to be changed.
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.
Looks good!
Fixes two-stage model selection used by IV models, so that we first select and train nuisances for y, t, etc., and then select and train the covariance model. Added central documentation for how to specify how to select models and simplifies the documentation for each estimator by pointing there.