Repository navigation
Fix model fitting when modeltime is not attached - #267
Open
pedroborges-melo wants to merge 1 commit into
Open
pedroborges-melo wants to merge 1 commit into
pedroborges-melo wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey @mdancho84, I came across this while using modeltime from another package.
In package code, dependencies are normally declared in
DESCRIPTIONandNAMESPACE, and their functions are called withmodeltime::.... Callinglibrary(modeltime)inside a package is generally avoided because it changes the user's search path.With that setup, creating a model specification works normally:
However, fitting the model can fail with:
Calling
library(modeltime)makes the error disappear, but only because it places the fitting functions on the search path. The functions are currently registered without their package name, so parsnip may not be able to resolve them when modeltime is loaded as a namespace but not attached.This PR adds
pkg = "modeltime"to the affected fit registrations. It also adds a regression test covering every active modeltime fit bridge and checks that the registered functions are exported.This allows downstream packages to use modeltime through the usual package dependency mechanism, without attaching it or importing the fitting functions individually.
Testing
The focused registration test passes all 41 assertions and covers the 20 active model and engine registrations.