cstjean / ScikitLearn.jl

Julia implementation of the scikit-learn API https://cstjean.github.io/ScikitLearn.jl/dev/
Other
547 stars 75 forks source link

Wrong Warning while using sk_import #86

Open leonardtschora opened 4 years ago

leonardtschora commented 4 years ago

Hi everyone,

This is not really an issue, more of a copy-past mistake in an error message I think. The following code

using ScikitLearn
@sk_import model_selection: GridSearchCV

Warns me with

┌ Warning: Module model_selection has been ported to Julia - try import ScikitLearn: CrossValidation instead └ @ ScikitLearn.Skcore C:\Users\user.julia\packages\ScikitLearn\uiLep\src\Skcore.jl:150

It seems to me that the proper way to use the Julia Grid Search tool is by doing:

using ScikitLearn.GridSearch: GridSearchCV

(The grid search is not in CrossValidation).

I use ScikiLearn.jl version v0.6.1 by the way.

cstjean commented 4 years ago

Yes, that looks right. Would you like to make a pull request?

leonardtschora commented 4 years ago

This seems to come from Skcore.jl, line 178:

@warn("Module $mod has been ported to Julia - try `import ScikitLearn: $(translated_modules[mod])` instead")

Which leads to line 43

translated_modules =
    Dict(:model_selection => :CrossValidation,
         :pipeline => :Pipelines,
         :grid_search => :GridSearch)

There is no scklearn.grid_search anymore in Python; both Cross Validation and Grid Search tools are under sklearn.model_selection.

To solve this and print the correct Julia module to import, we should either mix the GridSearch and CrossValidation Julia modules (as they did in Python) or have a look-up table with all the function names and which Julia module do they belong too.

It migth be a bit too much work for just a wrong warning :)