Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative to #599 with less logging #600

Merged
merged 17 commits into from
Aug 23, 2021
Merged

Conversation

ablaom
Copy link
Member

@ablaom ablaom commented Aug 2, 2021

Continuation of #599, implementing variation suggested at #599 (comment)

julia> e = evaluate(model, X, y, measures=[LogLoss(), Accuracy()])
Evaluating over 6 folds: 100%[=========================] Time: 0:00:00
PerformanceEvaluation object with these fields:
  measure, measurement, operation, per_fold,
  per_observation, fitted_params_per_fold,
  report_per_fold, train_test_pairs
extract:
┌─────────────────────────────────┬─────────────┬──────────────┬──────────────────────────────────────────────────┐
│ measure                         │ measurement │ operation    │ per_fold                                         │
├─────────────────────────────────┼─────────────┼──────────────┼──────────────────────────────────────────────────┤
│ LogLoss(tol = 2.22045e-16) @3621.08        │ predict      │ [2.22e-16, 2.22e-16, 2.12, 2.12, 2.25, 2.22e-16] │
│ Accuracy() @0970.97        │ predict_mode │ [1.0, 1.0, 0.941, 0.941, 0.938, 1.0]             │
└─────────────────────────────────┴─────────────┴──────────────┴──────────────────────────────────────────────────┘

@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2021

Codecov Report

Merging #600 (a218207) into dev (d0726dd) will increase coverage by 0.56%.
The diff coverage is 84.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #600      +/-   ##
==========================================
+ Coverage   85.15%   85.71%   +0.56%     
==========================================
  Files          37       37              
  Lines        3192     3269      +77     
==========================================
+ Hits         2718     2802      +84     
+ Misses        474      467       -7     
Impacted Files Coverage Δ
src/MLJBase.jl 100.00% <ø> (ø)
src/operations.jl 80.76% <ø> (ø)
src/show.jl 36.64% <50.00%> (+15.12%) ⬆️
src/resampling.jl 89.79% <87.30%> (+0.25%) ⬆️
src/measures/measures.jl 94.00% <100.00%> (+3.52%) ⬆️
src/composition/abstract_types.jl 40.00% <0.00%> (-21.54%) ⬇️
src/measures/finite.jl 92.71% <0.00%> (-3.89%) ⬇️
src/univariate_finite/arrays.jl 100.00% <0.00%> (ø)
... and 7 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 d0726dd...a218207. Read the comment docs.

@ablaom
Copy link
Member Author

ablaom commented Aug 12, 2021

@CameronBieganek Assuming you're pretty busy. But in case this fell off your radar... 🙏🏾

@CameronBieganek
Copy link
Collaborator

@ablaom Yeah, I've been pretty tied up lately. And I'm going on a short trip Sunday through Wednesday. But I would definitely like to help—I'll try to squeeze this in before I leave. 😃

Copy link
Collaborator

@CameronBieganek CameronBieganek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good overall. I made a few minor comments here and there.

Are all those verbosity=0 in the unit tests still needed with the new version of this PR?

src/operations.jl Outdated Show resolved Hide resolved
src/resampling.jl Outdated Show resolved Hide resolved
src/resampling.jl Outdated Show resolved Hide resolved
src/resampling.jl Outdated Show resolved Hide resolved
@@ -465,12 +501,18 @@ function _check_measure(measure, model, y, operation)
if model isa Probabilistic
if operation == predict
if prediction_type(measure) != :probabilistic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can reduce the nesting of the if blocks by writing

if (model isa Probabilistic) && (operation == predict) && (prediction_type(measure) != :probabilistic)

I'm guessing you wrote it your way for readability or to stay within the line length limit, but I think the logic is easier to understand when the conditions are combined into one boolean expression.

Maybe something like this for a readable typesetting:

is_non_probabilistic_measure = (
    model isa Probabilistic &&
    operation == predict &&
    prediction_type(measure) != :probabilistic
)

if is_non_probabilistic_measure
    # ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Adopted.

src/resampling.jl Outdated Show resolved Hide resolved
src/resampling.jl Outdated Show resolved Hide resolved
src/resampling.jl Outdated Show resolved Hide resolved
src/show.jl Outdated Show resolved Hide resolved
test/composition/models/from_network.jl Outdated Show resolved Hide resolved
ablaom and others added 10 commits August 23, 2021 14:47
(x..., y, z) instead of tuple(x..., y, z)

Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
Co-authored-by: Cameron Bieganek <8310743+CameronBieganek@users.noreply.github.com>
@ablaom
Copy link
Member Author

ablaom commented Aug 23, 2021

@CameronBieganek Many thanks for looking over this!

Sorry about verbosity=0 solution. I should have put that in a separate PR. No it was not needed here. Just that all the noise in the test log was driving me batty.

@ablaom ablaom merged commit 7f73e23 into dev Aug 23, 2021
This was referenced Aug 23, 2021
@DilumAluthge DilumAluthge deleted the auto-operation-less-verbose branch January 23, 2022 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants