Comments (3)
Issue name is incorrect, MLJ handles tables just fine and MLJLM handles matrices as it should too; the interface is handled by MLJ; the issue here is that you did not encode the categorical features.
julia> using DataFrames, CategoricalArrays, ScientificTypes, MLJModelInterface, MLJBase
julia> X = hcat(DataFrame(randn(10, 5), :auto), DataFrame(CategoricalArray.(eachcol(rand(["1", "2", "3", "4"], 10, 5))), :auto); makeunique=true);
julia> schema(X)
┌───────┬───────────────┬──────────────────────────────────┐
│ names │ scitypes │ types │
├───────┼───────────────┼──────────────────────────────────┤
│ x1 │ Continuous │ Float64 │
│ x2 │ Continuous │ Float64 │
│ x3 │ Continuous │ Float64 │
│ x4 │ Continuous │ Float64 │
│ x5 │ Continuous │ Float64 │
│ x1_1 │ Multiclass{4} │ CategoricalValue{String, UInt32} │
│ x2_1 │ Multiclass{4} │ CategoricalValue{String, UInt32} │
│ x3_1 │ Multiclass{3} │ CategoricalValue{String, UInt32} │
│ x4_1 │ Multiclass{4} │ CategoricalValue{String, UInt32} │
│ x5_1 │ Multiclass{4} │ CategoricalValue{String, UInt32} │
└───────┴───────────────┴──────────────────────────────────┘
julia> typeof(MLJModelInterface.matrix(X))
Matrix{Any} (alias for Array{Any, 2})
The MLJModelInterface.matrix(X)
is how MLJ takes training data and passes it over to MLJLinearModels; as you can see the output is an un-typed matrix because it's got columns of strings with "1"
, "2"
etc.
TLDR: use an encoder then pass to the linear regressor.
from mljlinearmodels.jl.
Unrelated to MLJLinearModels. Please ask on discourse for help or possibly open an issue in MLJ directly. The data that gets passed through is not properly typed. You can see that here:
julia> tuned_machine = machine(config, x[:, Not(1)], x[:, 1]) |> fit!
ERROR: MethodError: no method matching fit(::GeneralizedLinearRegression{L2Loss, NoPenalty}, ::Matrix{Any}, ::Vector{Float64}; solver::Analytical)
It should be a Matrix{<:Real}
, this suggests that you might have missed an encoding step.
from mljlinearmodels.jl.
The data that gets passed through is not properly typed. You can see that here:
Right, sorry, I was under the impression that MLJ models were expected to accept arbitrary tables as inputs, rather than just accepting Matrix{<:Real}
. I'll edit this issue, then.
from mljlinearmodels.jl.
Related Issues (20)
- Docs for L1+std HOT 1
- `LogisticClassifier` lambda and gamma are easy to confuse HOT 1
- Problems when only one class manifest in the training target HOT 5
- What is the new scale_penalty_with_samples=true doing? HOT 12
- TagBot not working HOT 7
- Ncvreg wrapper HOT 1
- `predict` throws an error for `MultinomialClassifier` on crabs dataset
- Unexpected behaviour with LogisticClassifier HOT 5
- Add MLJ compliant doc strings to all models
- Help with documentation review HOT 9
- Test proxgrad with gamma=0 HOT 1
- Add MLJTestInterface tests
- cov-only training for L2Loss HOT 3
- Testing quantreg vs MLJLinearModels HOT 7
- should scale_penalty_with_samples = true be defualt? HOT 4
- Expand docs to include cut and past examples for different Regressors HOT 3
- box (or just positive) constraints on enet OLS HOT 4
- generalized / group lasso HOT 1
- Huber breakpoint parameter in quantile form? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mljlinearmodels.jl.