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

Can a supervised model also implement the transform method. #117

Closed
OkonSamuel opened this issue Oct 31, 2019 · 4 comments
Closed

Can a supervised model also implement the transform method. #117

OkonSamuel opened this issue Oct 31, 2019 · 4 comments

Comments

@OkonSamuel
Copy link
Member

Can a supervised model also implement the transform method or is it restricted to unsupervised models only.

@ablaom
Copy link
Member

ablaom commented Oct 31, 2019

Yes, it can!

Curious about the use case.

In MLJFlux we are working on neural nets that learn feature embeddings along with the main layers. The transform method maps the categorical features into their learned embeddings for use in other models that only handle continuous data.

@OkonSamuel
Copy link
Member Author

Oh I just thought may want to use lda to reduce the dimension of a dataset before applying another classification model

@tlienart
Copy link
Collaborator

right so you want to have a transform that uses the projection matrix learned in the LDA? I think you can "just" do that by defining a MLJBase.transform(::BayesianLDA ... )

@ablaom
Copy link
Member

ablaom commented Oct 31, 2019

You should also declare an output_scitype. Currently this is not reported in the registry unless the model is unsupervised, and I don't think this is used. However, for future proofing, it would be good to have. So, you probably want something like:

using ScientificTypes
MLJBase.output_scitype(::Type{<:BayesianLDA}) = Table(Continuous)

This is assuming you convert your transformed inputs into tabular form (the recommendation for consistency with PCA, and so forth), which you do with MLJBase.table(Xreduced). This automatically adds labels to the columns (x1, x2, etc I think).

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

3 participants