Repository navigation
Fix predictions with missing y values - #15
LaurianeJD wants to merge 2 commits into
Conversation
… in the fit deflation
nielsschlusser
left a comment
There was a problem hiding this comment.
Looks good to me in general!
One minor question with regards to the test, otherwise good to merge from my side.
Let's wait for PR #14 , though.
…n new random dataset
nielsschlusser
left a comment
There was a problem hiding this comment.
Looks good to me now. Thanks for your contribution!
Please wait with merging until the merge of PR #14 .
|
@nielsschlusser Sure! After PR #14 is merged, I'll also add here the remaining necessary changes that I listed in #14 (comment) to make sure everything is consistent :) |
|
Hey @LaurianeJD I just had another thought: Shall we try to tighten the limits for the prediction unittest? I'd imagine the accuracy on the incomplete datasets should be increased. What do you think? |
|
@nielsschlusser As far as I understood, |
Purpose
Fix
NipalsPLS.predict()when y has missing values, as discussed in #14 (see comment there for more details).Background
The fit deflates y with
T Qᵀ, butpredict()returnedT diag(b) Qᵀ. The inner coefficientsbare exactly 1 for complete y, but not when y has missing values, wherepredict()then doesn't reproduce the fitted y, even on the training data.Changes
predict():Ŷ = T Qᵀ, withoutregression_matrix(bterm)get_reg_vector(): same, withoutregression_matrixtest_predict_with_missing_y(): fails onmain, passes with the fixThe test uses a small random example rather than existing test data:
YData.csvhas a single complete y column (b= 1). A second target built from the spectra with missing values (as in #14) shows the problem only weakly (b≈ 1.0004), while this random example shows it clearly (b= 3.4).Results with complete y are unchanged.
Caveat
Overlaps with #14: both PRs change
get_reg_vector(), and this fix also covers #14'sset_components()growth fix with missing y. See my comment there.@nielsschlusser @arden13