SossMLJ.jl icon indicating copy to clipboard operation
SossMLJ.jl copied to clipboard

Fix `predict_particles`, and implement the Brier score

Open DilumAluthge opened this issue 4 years ago • 15 comments

Fixes #93 Fixes #117 Related to #52

Please note that this PR makes multiple breaking changes.

DilumAluthge avatar Sep 16 '20 01:09 DilumAluthge

@cscherrer This is now ready for review.

I'm going to leave it as a "draft" so that we don't accidentally click merge. We don't need to merge this until the package registration is complete. (The package registration PR will be auto-merged in 3 days.)

DilumAluthge avatar Sep 16 '20 09:09 DilumAluthge

@cscherrer I completely forgot about this PR.

Is there anything else we need to do before merging this PR?

DilumAluthge avatar Mar 29 '21 00:03 DilumAluthge

Thanks @DilumAluthge , I'm sorry I had forgotten about it too.

Not sure what's going on with the tests, but let's merge this ASAP so we don't lose track of it again. We're also making some big changes in Soss that will be in the next release, to we'll need to come back to this to update once that's out.

cscherrer avatar Mar 29 '21 02:03 cscherrer

I've rebased this on the latest master. CI is passing on master, but it is failing on this PR, so I think there is a problem in this PR.

Any idea why the tests are failing?

An example error is:

LoadError: ArgumentError: Cannot convert a particle distribution to a float if not all particles are the same.

DilumAluthge avatar Mar 29 '21 07:03 DilumAluthge

The tests were previously passing on this PR, so my guess is there has been a breaking change in one of our dependencies. Maybe Soss, or MonteCarloMeasurements.

DilumAluthge avatar Mar 29 '21 07:03 DilumAluthge

Maybe there was some breaking change in the behavior of the Soss.particles function?

DilumAluthge avatar Mar 29 '21 07:03 DilumAluthge

There was a change in master, because MonteCarloMeasurements exports some Distributions functions that collide with MeasureTheory. I don't think it affected the release though

cscherrer avatar Mar 29 '21 12:03 cscherrer

Hmmm. Any idea what's causing this error?

Since CI is passing on master, I'd prefer to get CI passing on this PR before merging it; otherwise we'll break master 😂

DilumAluthge avatar Mar 29 '21 19:03 DilumAluthge

Looks like we're getting closer!

The error is now:

LoadError: type Array has no field β

And it comes from this code: https://github.com/cscherrer/SossMLJ.jl/blob/0b2f9b29037b555ad0834aa63d27408a3da2c709/test/extra-example-tests/linear-regression.jl#L9-L13

DilumAluthge avatar Mar 29 '21 23:03 DilumAluthge

Bump @cscherrer

DilumAluthge avatar Apr 09 '21 17:04 DilumAluthge

Ah, right! Thanks for the ping, I'll have another look now. I'd love to have it working for the new release, but sampling syntax changed so that will take some more changes

cscherrer avatar Apr 09 '21 18:04 cscherrer

Ok, I see the problem:

julia> SossMLJ._predict_all_particles(mach, X)
100-element Vector{Particles{Float64, 1000}}:
 -0.482 ± 0.27
 -0.00677 ± 0.26
 -0.0659 ± 0.27
 -0.0272 ± 0.28
  0.205 ± 0.25
 -0.105 ± 0.27

The line 10 you posted above tries to get the property from this, but there is none

cscherrer avatar Apr 09 '21 18:04 cscherrer

Hmmm. The idea of SossMLJ._predict_all_particles is that it should return particles for everything. So it should have the particles for , , , and .

My guess is that there's a bug in the implementation of _predict_all_particles.

In 0b2f9b29037b555ad0834aa63d27408a3da2c709, you made some fixes to the predict_particles function. I think you'll also need to apply those same fixes to the _predict_all_particles function.

DilumAluthge avatar Apr 10 '21 10:04 DilumAluthge

Codecov Report

Merging #118 (1a76253) into master (0baac33) will decrease coverage by 9.55%. The diff coverage is 87.50%.

@@             Coverage Diff             @@
##            master     #118      +/-   ##
===========================================
- Coverage   100.00%   90.44%   -9.56%     
===========================================
  Files            6       12       +6     
  Lines           92      136      +44     
===========================================
+ Hits            92      123      +31     
- Misses           0       13      +13     
Impacted Files Coverage Δ
src/machine-operations.jl 100.00% <ø> (ø)
src/loss-functions/brier-score.jl 53.33% <53.33%> (ø)
src/loss-functions/rms.jl 66.66% <66.66%> (ø)
src/check-rows.jl 75.00% <75.00%> (ø)
src/particles.jl 95.23% <94.73%> (-4.77%) :arrow_down:
src/categorical-arrays.jl 100.00% <100.00%> (ø)
src/distributions.jl 100.00% <100.00%> (ø)
src/loss-functions/types.jl 100.00% <100.00%> (ø)
src/models.jl 100.00% <100.00%> (ø)
src/prediction.jl 100.00% <100.00%> (ø)
... and 2 more

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 0baac33...1a76253. Read the comment docs.

codecov[bot] avatar Apr 13 '21 21:04 codecov[bot]

Looks like CI is finally passing. Sometime this week (or maybe next week), I'll add tests to increase code coverage.

Coverage is 100% on master, and I'd like to keep it at 100%.

DilumAluthge avatar Apr 13 '21 21:04 DilumAluthge