You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
More sophisticated example of learning networks #9
Your problem: LinearRegressor() expects a table but it is getting a matrix here. So you need to insert an MLJTable.
Another problem: You can't apply the inverse_transform directly to ẑ because it makes probablisitic predictions. So you need to insert a mean. Sadly, mean is not overloaded for nodes, so you need to use the node method to do this yourself
The following code works:
using MLJ
Xr, yr =@load_boston
zr =rand(length(yr))
X =source(Xr)
y =source(yr)
z =source(zr)
W = X |>Standardizer()
z = y |>UnivariateBoxCoxTransformer()
ẑ₁ = (W, z) |>@load RidgeRegressor pkg=MultivariateStats
ẑ₂ = (W, z) |>@load DecisionTreeRegressor
R = MLJ.table(hcat(ẑ₁, ẑ₂))
ẑ_prob = (R, z) |>@load LinearRegressor pkg=GLM
ẑ =node(v->mean.(v), ẑ_prob)
ŷ = ẑ |>inverse_transform(z)
fit!(ŷ)
ŷ()
Side comment: A great non-trivial example is stacking, as suggested by the diagram on the MLJ Readme.
Activity
tlienart commentedon Oct 22, 2019
Hmm the KNNRidge blend example is actually just that. But I'd still be curious to understand what I did wrong above
ablaom commentedon Oct 23, 2019
Your problem: LinearRegressor() expects a table but it is getting a matrix here. So you need to insert an
MLJTable.Another problem: You can't apply the inverse_transform directly to
ẑbecause it makes probablisitic predictions. So you need to insert amean. Sadly,meanis not overloaded for nodes, so you need to use thenodemethod to do this yourselfThe following code works:
Side comment: A great non-trivial example is stacking, as suggested by the diagram on the MLJ Readme.
ablaom commentedon Oct 23, 2019
Or you could have used
predict_meanbut then you couldn't use the arrow syntax, I guess.