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

Out-of-fold predictions for unsupervised models? #1025

Open
salbalkus opened this issue Jun 10, 2023 · 2 comments
Open

Out-of-fold predictions for unsupervised models? #1025

salbalkus opened this issue Jun 10, 2023 · 2 comments

Comments

@salbalkus
Copy link

I have written a custom unsupervised learning model that implements transform and fit. I'd like to use MLJ to perform resampling and obtain out-of-fold output for this model. For example, given a 5-fold cross-validation, I would like to fit the model on four of the folds and obtain the output of transform on the left out fold - and then, repeat this until I've obtained "out-of-fold predictions" for each fold.

Is there (or could there be) an easy way to do using MLJ without having to write my own function to extract folds? As mentioned in #575, evaluate! with a custom measure that simply returns the prediction can accomplish this for supervised models. However, this does not appear to work for unsupervised models since evaluate! seems to require a predict method and a y value.

@ablaom
Copy link
Member

ablaom commented Jun 15, 2023

@salbalkus Yes, currently evaluate! is limited to models that can predict, which does include outlier detection models, but not general unsupervised models.

I think your suggestion to add some kind of support makes sense. As you say, this is closely related to #575 , which could be dealt with at the same time.

Also related is: JuliaAI/MLJBase.jl#660

@ablaom
Copy link
Member

ablaom commented Jun 15, 2023

In the meantime, you might be able to implement what you want using a learning network as well. The MLJ Stack composite model is implemented using learning networks, and there you splice together "out-of-fold predictions" just like you describe.

See this tutorial for the general idea. The way learning networks are exported as stand-alone models has changed (@from_network appearing in the tute is deprecated). See here for the latest docs.

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