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

Confusing true_negative(x, y) error #919

Closed
dario-brooks opened this issue Apr 1, 2022 · 2 comments
Closed

Confusing true_negative(x, y) error #919

dario-brooks opened this issue Apr 1, 2022 · 2 comments

Comments

@dario-brooks
Copy link

Describe the bug

When trying to run "true_negative(x, y)" on two simple vectors x and y, I get a TypeError, which I have pasted below along with the code to reproduce it.
I've tried this within VSCode, then within a fresh Julia REPL in the terminal, then tried uninstalling and reinstalling Julia 1.7.2, then tried updating the MLJ package, etc. Assuming I've done the above troubleshooting steps correctly, the error persists...

To Reproduce

julia> using MLJ

julia> y = coerce([1.0, 0.0, 0.0], OrderedFactor)
3-element CategoricalArrays.CategoricalArray{Float64,1,UInt32}:
 1.0
 0.0
 0.0

julia> yp = coerce([1.0, 0.0, 0.0], OrderedFactor)
3-element CategoricalArrays.CategoricalArray{Float64,1,UInt32}:
 1.0
 0.0
 0.0

julia> MLJ.true_negative(y, yp)
ERROR: TypeError: non-boolean (Nothing) used in boolean context
Stacktrace:
 [1] _confmat::CategoricalArrays.CategoricalVector{Float64, UInt32, Float64, CategoricalArrays.CategoricalValue{Float64, UInt32}, Union{}}, y::CategoricalArrays.CategoricalVector{Float64, UInt32, Float64, CategoricalArrays.CategoricalValue{Float64, UInt32}, Union{}}; rev::Nothing, perm::Nothing, warn::Bool)
   @ MLJBase ~/.julia/packages/MLJBase/hLtde/src/measures/confusion_matrix.jl:98
 [2] (::TrueNegative)(ŷ::CategoricalArrays.CategoricalVector{Float64, UInt32, Float64, CategoricalArrays.CategoricalValue{Float64, UInt32}, Union{}}, y::CategoricalArrays.CategoricalVector{Float64, UInt32, Float64, CategoricalArrays.CategoricalValue{Float64, UInt32}, Union{}})
   @ MLJBase ~/.julia/packages/MLJBase/hLtde/src/measures/finite.jl:649
 [3] top-level scope
   @ REPL[5]:1

Note: I have also tried "MLJBase.true_negative(y, yp)" and simply "true_negative(y, yp)". Each returns the same error.

Expected behavior

true_negative(x, y) should return the number of true negatives for observations x and ground truth y, so it should give an integer. For the vectors above, it should return 2, for example.

Additional context

System setup: Base model 2021 Macbook Air with the M1 chip.

Versions
Running Julia v1.7.2, installed via Homebrew. (Previously running v1.7 installed via .dmg; gave an identical error).

Thank you for the support!!

@ablaom
Copy link
Member

ablaom commented Apr 3, 2022

@dario-brooks Thank you for reporting.

I could not reproduce using latest version of MLJBase (0.19.8).

Can you please report the output of using Pkg; Pkg.status()?

@ablaom
Copy link
Member

ablaom commented Apr 29, 2022

@dario-brooks If you are able to assist as per previous comment, feel free to re-open.

@ablaom ablaom closed this as completed Apr 29, 2022
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

No branches or pull requests

2 participants