JuliaAI / JuliaAI/MLJDecisionTreeInterface.jl
How to adapt to breaking change in `fit` and `predict` for DecisionTree.jl models
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 9
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Version 0.3.1 (to be yanked) and version 0.4 introduced a breaking change to MLJModelInterface.fit and MLJModelInterface.predict for all 5 models. This change only effects developers who directly call those functions. Regular MLJ users who interact through the usual "machine" interface are not affected.
What changed is that the models mentioned now implement the MLJModelInterface data-front end. The most likely reason for breakage is that fit and predict are not being called with the model-specific form of data generated by the reformat method. This post describes a backwards-compatible fix.
Adding the model-specific pre-processor reformat to your fit/predict calls
If you are not already using reformat in your fit and predict calls then, where you previously made a call
MMI.fit(model, verbosity, data...) # MMI = MLJModelInterface
you instead want
MMI.fit(model, verbosity, MMI.reformat(model, data...)...)
And instead of
MMI.predict(model, fitresult, Xnew)
you want
MMI.predict(model, fitresult, MMI.reformat(model, Xnew)...)
You have backwards compatibility because the fallback for reformat just slurps the data. This also means you can change these calls for all models (not just the DecisionTree ones).
Subsampling
If you subsample reformatted data before passing to fit or predict, you should always use subsampled_data = selectrows(model, I, reformatted_data...) where I is the indices for subsampling.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the migration examples in the issue body for MMI.fit, MMI.predict, reformat, and selectrows. Done means documenting the backwards-compatible calling forms and subsampling rule; the payload names no repository file, test, or entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100