Weights in pipelines
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- julia
- Domain
- machine-learning
Research direction
Start at the machine(..., weights) and fit! entry points shown in the issue, comparing direct-model handling with Pipeline behavior. Trace how unsupported weights are reported in each path and identify the existing tests covering weighted fitting. Done means unsupported weights are handled consistently in direct models and pipelines, with tests confirming the expected failure behavior.
Written by the indexing model from the issue text.
Description
Hello,
I am trying to use weights in MLJ and surprised by the behaviour in a pipeline which I think is a bug. In the following, the supervised component does not support weights but neither an error is thrown nor a warning displayed.
using MLJBase
using MLJModels
using MLJLinearModels
n = 100
X = (A=categorical(rand([0, 1], n)), B=categorical(rand([0, 1], n)))
y = categorical(rand([0, 1], n))
weights = [y_ == true ? 0.1 : 0.8 for y_ in y]
pipe = Pipeline(MLJModels.ContinuousEncoder(), LogisticClassifier())
# Train without weights: all good
unweighted_mach = machine(pipe, X, y)
fit!(unweighted_mach, verbosity=2)
preds_unweighted = predict(unweighted_mach)
# Train with weights: no warning, no error and weights are ignored
weighted_mach = machine(pipe, X, y, weights)
fit!(weighted_mach, verbosity=2)
preds_weighted = predict(weighted_mach)
[x.prob_given_ref[1] for x in preds_unweighted] == [x.prob_given_ref[1] for x in preds_weighted] # returns true
More generally, outside a pipeline, passing weights to models that don't support it only prints a warning and fit proceeds. I thought it would throw an error:
n = 100
X = (A=rand(n), B=rand(n))
y = categorical(rand([0, 1], n))
weights = [y_ == true ? 0.1 : 0.8 for y_ in y]
weighted_mach = machine(LogisticClassifier(), X, y, weights) # warning here
fit!(weighted_mach)
predict(weighted_mach)
- Dominant language
- Julia
- Stars
- 164
- Forks
- 46
- Avg merge
- 23h 18m
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from JuliaAI/MLJBase.jl
-
Evaluate is using `external_aggregation_mode` of a measure to perform "internal" aggregationPossibly taken @ablaom claimed this 18 days ago. Open
JuliaAI/MLJBase.jl#1088 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
JuliaAI/MLJBase.jl#1085 ·
Maintainers usually reply within 1 day
-
Have `unpack` support `String` names for the columnsPossibly taken @OkonSamuel claimed this 297 days ago. Open
JuliaAI/MLJBase.jl#1043 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
next breaking release
Difficulty 3/5 1-2 days Newbie friendliness 35/100
JuliaAI/MLJBase.jl#1021 ·
Maintainers usually reply within 1 day
-
next breaking release
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaAI/MLJBase.jl#1002 ·
Maintainers usually reply within 1 day
All issues in JuliaAI/MLJBase.jl
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Sienna-Platform/PowerSimulations.jl#1737 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FluxML/Optimisers.jl#254 ·
-
Minor: floodplain warning percentage, scalar output error message and a never-true identity checkOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JuliaAI/MLJTransforms.jl#101 ·
Maintainers usually reply within 1 day
-
@contents blocks fail to render on Julia 1.14Possibly taken @sbfnk claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
LuxDL/DocumenterVitepress.jl#410 ·