Skip to content
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

Is the Averager documentation deprecated? #1039

Closed
era127 opened this issue Aug 24, 2023 · 2 comments
Closed

Is the Averager documentation deprecated? #1039

era127 opened this issue Aug 24, 2023 · 2 comments

Comments

@era127
Copy link
Contributor

era127 commented Aug 24, 2023

In the documentation for Static transformers the example for the Averager uses @from_network but when I run that example it indicates that the way the code deprecated. Is the code in that example deprecated?

I'm just starting to look at MLJ and I'm interested in making a network that averages an array of continuous regression models. Alternatively is it possible to use stack but with a metalearner that just is average instead of a linear model?

X = source()
y = source() 

ridge = (@load RidgeRegressor pkg=MultivariateStats)()
knn = (@load KNNRegressor)()
averager = Averager(0.5)

hotM = machine(OneHotEncoder(), X)
W = transform(hotM, X) # one-hot encode the input

ridgeM = machine(ridge, W, y)
y1 = predict(ridgeM, W)

knnM = machine(knn, W, y)
y2 = predict(knnM, W)

averagerM= machine(averager)
yhat = transform(averagerM, y1, y2)

learning_mach = machine(Deterministic(), X, y; predict=yhat)

@from_network learning_mach struct DoubleRegressor
       regressor1=ridge
       regressor2=knn
       averager=averager
       end

┌ Warning: Learning network machines are deprecated. For the recommended way of exporting learning networks as new stand-alone model types, see the "Learning Networks" section of the MLJ manual. 
@ablaom
Copy link
Member

ablaom commented Aug 24, 2023

Yes, you are right, @rdavis120, the example is out of date. Thanks for pointing this out.

You can find an update to the example here.

Alternatively is it possible to use stack but with a metalearner that just is average instead of a linear model?

That won't work. The metalearner needs to be supervised model.

@ablaom
Copy link
Member

ablaom commented Aug 24, 2023

Closed in favour of #1040.

@ablaom ablaom closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants