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
Classification task: no models #153
Comments
You are right, this is a bug! Thanks. But a curly one: julia> using MLJ
julia> task = load_iris()
julia> task.target_scitype_union
Multiclass{3}
julia> info("SVMClassifier")[:target_scitype_union]
Finite
julia> Multiclass{3} <: Finite
true But check this out: julia> task.target_scitype_union <: info("SVMClassifier")[:target_scitype_union]
false ????? There appear to be two distinct julia> info("SVMClassifier")[:target_scitype_union] === Finite
true we have julia> objectid(Finite)
0x2dc1c6a52a98fbfa
julia> objectid(info("SVMClassifier")[:target_scitype_union])
0x55508700e378482e My only thought at the moment is that this has something to do with the JSON encoding/decoding of the model metadata. But this is weird. |
I can reproduce what you explain.
Are there 2 "Finite" types defined in different places? Could this be happening because we might have several MLJ versions and MLJBase versions installed? |
Well Is this what is causing the problem?
|
Thank you indeed for that confirmation! I observed the same things. I think I've got it now. In definition of metadata() I make a deepcopy of the metadata dictionary, which also copies types (dah). julia> abstract type Finite end
julia> deepcopy(Finite)
Finite And then obviously julia> objectid(T) == objectid(Finite)
false |
Resolved. julia> using MLJ
julia> @load DecisionTreeClassifier
import MLJModels ✔
import DecisionTree ✔
import MLJModels.DecisionTree_.DecisionTreeClassifier ✔
julia> task = load_iris()
julia> models(task)
Dict{String,Any} with 2 entries:
"ScikitLearn" => Any["SVMNuClassifier", "SVMClassifier", "SVMLClassifier"]
"LIBSVM" => Any["LinearSVC", "NuSVC", "SVC"]
julia> task.is_probabilistic = true
julia> models(task)
Dict{String,Any} with 4 entries:
"MLJ" => Any["ConstantClassifier", "DecisionTreeClassifier"]
"DecisionTree" => Any["DecisionTreeClassifier"]
"NaiveBayes" => Any["GaussianNBClassifier"]
"XGBoost" => Any["XGBoostClassifier"] @davidbp Thanks again for spotting this and spending time investigating! |
Thanks for solving the issue. I actually thought the deepcopy could be the source of the error but I tried the following and got the same objectid:
Interestingly enough it seems that it is what you just posted.
I get
I tried to update MLJ and test it again but ...
|
Let me add that if I do
I still face some issues with the Package Manager, I have no idea why. For me it is allways best to simply |
When you add a git URL or |
Yes, I didn't faithfully copy my snippet. The behaviour depends on your type having parameters. Here's a corrected version of the example: julia> abstract type Finite{N} end
julia> T = deepcopy(Finite)
Finite
julia> objectid(T) == objectid(Finite)
false |
Regarding this: "I tried to update MLJ and test it again but ...
" Looks to me that you updated your env but didn't restart your REPL session. I say this because you get "A model named DecisionTreeClassifier is already loaded". Updating you env won't replace the code you have already loaded (repeating "using MLJ" has no effect). Sorry, you probably realise this, but this my guess. |
I wanted to see what models would MLJ propose for the iris dataset and got an empty dict.
If I look simply at models I can clearly see a bunch of classification options
There are some options in the
filter
inside.julia/packages/MLJ/CbtVd/src/loading.jl
that seem to give a somewhat unexpected behaviour.My info
The text was updated successfully, but these errors were encountered: