FluxML / FastAI.jl

Repository of best practices for deep learning in Julia, inspired by fastai
https://fluxml.ai/FastAI.jl
MIT License
587 stars 52 forks source link

Support for non-supervised learning tasks #165

Closed lorenzoh closed 2 years ago

lorenzoh commented 3 years ago

So right now, much of the data block magic is specialized on supervised learning tasks, e.g. blocklossfn, blockmodel and the visualizations. It would be nice to better support other kinds of tasks as well. The underlying APIs are already pretty general, e.g. encode has no restraints on number of blocks encodings. It's more that right now, BlockMethod assumes a tuple (inputblock, targetblock) and uses that to determine what block the model output is and what blocks are in a batch for visualization.

For the FastAI Q&A @darsnack prepared a variational autoencoder tutorial where the data is really just one image that itself is the target and we ended up having to overwrite some methods to get it to work.

So, the thing that is mostly different for different learning tasks, is how each block of data is used. Below I try to summarize the different kinds of blocks that need to be known to use the block method APIs.

For a basic supervised learning method, we have

For the autoencoder example, we have

This is how the blocks are used:

lorenzoh commented 2 years ago

Closed in #188. See https://fluxml.ai/FastAI.jl/dev/notebooks/vae.ipynb.html as an example.