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

Refactor fit and update #161

Merged
merged 3 commits into from
Jun 18, 2021
Merged

Refactor fit and update #161

merged 3 commits into from
Jun 18, 2021

Conversation

ablaom
Copy link
Collaborator

@ablaom ablaom commented Jun 15, 2021

This PR removes a lot of repeated code. Specifically, it abstracts out the model-specific parts of fit and update so that we can have a single fit and update method for MLJFlux models. Based on my recent work on this repo, this change will save time in maintenance and adding features, and prevent bugs.

A new entry to the readme explains further:


Adding new models to MLJFlux (advanced)

This section is mainly for MLJFlux developers. It assumes familiarity
with the MLJ model
API

If one subtypes a new model type as either
MLJFlux.MLJFluxProbabilistic or MLJFlux.MLJFluxDeterministic, then
instead of defining new methods for MLJModelInterface.fit and
MLJModelInterface.update one can make use of fallbacks by
implementing the lower level methods shape, build, and
fitresult. See the this source code for an example.

One still needs to implement a new predict method.

@ablaom ablaom requested a review from ayush-1506 June 15, 2021 02:26
@codecov-commenter
Copy link

Codecov Report

Merging #161 (07921fd) into dev (eb90873) will decrease coverage by 2.37%.
The diff coverage is 96.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #161      +/-   ##
==========================================
- Coverage   91.32%   88.94%   -2.38%     
==========================================
  Files           6        8       +2     
  Lines         265      208      -57     
==========================================
- Hits          242      185      -57     
  Misses         23       23              
Impacted Files Coverage Δ
src/builders.jl 62.50% <62.50%> (ø)
src/classifier.jl 100.00% <100.00%> (ø)
src/common.jl 96.36% <100.00%> (+4.69%) ⬆️
src/core.jl 90.27% <100.00%> (+2.77%) ⬆️
src/image.jl 100.00% <100.00%> (ø)
src/regressor.jl 100.00% <100.00%> (ø)
src/types.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb90873...07921fd. Read the comment docs.

@ablaom ablaom mentioned this pull request Jun 15, 2021
1 task
@ablaom
Copy link
Collaborator Author

ablaom commented Jun 16, 2021

@ayush-1506 Any chance you could give this a once over?

@ayush-1506
Copy link
Member

@ablaom Sure, will take a look at it later today.

Copy link
Member

@ayush-1506 ayush-1506 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ablaom Looks good! I glanced over the code and couldn't find any issues. Would love to give this a try once this is merged.

@ablaom ablaom merged commit 6c48032 into dev Jun 18, 2021
@ablaom ablaom deleted the refactor-fit-update branch June 18, 2021 00:12
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.

3 participants