JuliaAI / MLJModels.jl

Home of the MLJ model registry and tools for model queries and mode code loading
MIT License
79 stars 27 forks source link

fit OneHotEncoder without MLJBase #465

Closed olivierlabayle closed 2 years ago

olivierlabayle commented 2 years ago

Hello,

I am not sure I understand if this is expected. Due to some lacking interface definition, if MLJBase is not imported, one cannot fit a OneHotEncoder:

using MLJModels, MLJModelInterface, CategoricalArrays
model = OneHotEncoder()
X = (x=categorical(["a", "b", "a"]),)
fitresult, _, _ = fit(model, 1, X)
ablaom commented 2 years ago

Maybe not ideal, but not unexpected. MLJ provides model API implementers with some tools which will only work if MLJBase is imported, and these include selectrows. This was done to keep MLJModelInterface lightweight. For now, if you want use an MLJ model, your're expected to import MLJBase, even if you are not interacting though the machine interface but directly via the model interface.

In this particular instance, I suggest we wait for https://github.com/JuliaData/Tables.jl/pull/278 and replace selectrows with whatever Tables.jl provides. I think Tables.jl is already a dependency of MLJModels.jl.

But there may be other such methods that need MLJBase to work.

ablaom commented 2 years ago

Closing as essentially tracked by https://github.com/JuliaAI/MLJBase.jl/issues/791