Skip to content
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

Tuning dispatch framework for discussion #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gbohner
Copy link

@gbohner gbohner commented Jul 9, 2018

At the moment tuning seems to be implemented as a function that changes the parameters of a Learner. https://github.com/dominusmi/Julia-Machine-Learning-Review/blob/master/MLR/Tuning.jl

"""
    Tunes learner given a task and parameter sets.
    Returns a learner which contains best tuned model
"""
function tune(learner::Learner, task::Task, parameters_set::ParametersSet;
                sampler=Resampling()::Resampling, measure=MLMetrics.accuracy::Function,
                storage=MLRStorage()::MLRStorage)
    ...
    lrn = ModelLearner(lrn, modelᵧ, parameters_set)

    lrn

There are issues with this, the main one being, that if you apply tuning to a model, the composition of tuning-model is forgotten and only the best performing model is returned, which is of course conditional on the data available at a time. Ideally you would want to instead get a TunedLearner object, which behaves just as your original learner for all purposes, except when you fit it to data, it automatically tuned itself.

I attached a possible implementation (discussed with and approved by one of the more experienced Julia devs, Valentin Churavy), which we can use as a basis for discussing a wider framework of composable models.

@gbohner
Copy link
Author

gbohner commented Jul 9, 2018

For some reason the github viewer doesn't show the notebook properly, you can take a quick look here:
https://nbviewer.jupyter.org/github/gbohner/Julia-Machine-Learning-Review/blob/f3482badf1f275e2a98bf7e338d406d399609f37/MLR/TuningDispatch_framework.ipynb

@dominusmi
Copy link
Owner

dominusmi commented Jul 11, 2018

I was already planning on doing something like that so that's great!

Regarding the question Side design question: Should the returned model after ModelSelectionTuning be as simplified as possible, or retain its full complexity?
I've been struggling with that already, at the moment I went for simplified but that's been to simplify my life too so I'm not sure which approach is the best overall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants