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

fit_partial API #260

Closed
krstopro opened this issue Apr 23, 2024 · 5 comments
Closed

fit_partial API #260

krstopro opened this issue Apr 23, 2024 · 5 comments

Comments

@krstopro
Copy link
Member

krstopro commented Apr 23, 2024

For the past few days I have been trying to implement incremental PCA (#246, Task 1). One of the functions that should be implemented in the module is fit_partial that takes a model and a dataset and updates the model parameters. This is useful when the dataset itself cannot fit inside the memory and we must update the model batch by batch. However, the function itself assumes that the model is already created and can be passed as an argument. This means that there should be a way to create an initial model before feeding it the very first batch.

What would be the cleanest way to do this? I was thinking of adding a function new/1 to the module, but that slightly changes the fit/predict logic. Another way would be to require using fit on the first batch and then using fit_partial on the rest.

Any thoughts on this?

@josevalim
Copy link
Contributor

What about fit_stream that receives a stream and we implement the loop ourselves?

@krstopro
Copy link
Member Author

What about fit_stream that receives a stream and we implement the loop ourselves?

Yes, that is another possibility. Does deftransform allow for stream arguments?

@krstopro
Copy link
Member Author

krstopro commented Apr 23, 2024

Or it doesn't matter since it is a stream (lazy eval) and we can just use def? :)

@josevalim
Copy link
Contributor

You can just use def, yeah. :)

@krstopro
Copy link
Member Author

Thanks, closing the issue. ^_^

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