FluxML / FastAI.jl

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

Added Model for Time Series Classification #253

Closed codeboy5 closed 1 year ago

codeboy5 commented 2 years ago

I have added the code for a basic RNN Model for the task of time series classification.

> data, blocks = load(datarecipes()["ecg5000"]);
> task = TSClassificationSingle(blocks, data);
> model = FastAI.taskmodel(task);
> traindl, validdl = taskdataloaders(data, task, 32);
> callbacks = [ToGPU(), Metrics(accuracy)];
> learner = Learner(model, tasklossfn(task); data=(traindl, validdl), optimizer=ADAM(), callbacks = callbacks);
> fitonecycle!(learner, 10, 0.033)
image

As I discussed with @darsnack, the idea is to add an encoding to do the reshaping to (features, batch, time) instead of doing it inside on the RNN Model. Working on that right now.

Have remove the type from StackedLSTM as it was redundant.

codeboy5 commented 2 years ago

I have also added a multivariate classification dataset and verified the training loop is working fine for it.

codeboy5 commented 2 years ago

Hey guys, @ToucheSir @darsnack @lorenzoh. I have updated the notebook. This PR essentially contains code to load regression datasets and the notebook for the classification task. I will start adding the Inception Time Model in the next PR as we discussed during our weekly call.

lorenzoh commented 1 year ago

Great progress in my absence and cool to see the training working!

Are the outstanding comments being addressed in #256 or could this be merged individually beforehand?

codeboy5 commented 1 year ago

Great progress in my absence and cool to see the training working!

Are the outstanding comments being addressed in #256 or could this be merged individually beforehand?

I am resolving the outstanding comments in #256 , some of them have been resolved and a couple are left, which I will resolve by end of day. This can be merged then I believe.

codeboy5 commented 1 year ago

I think this PR is complete ? Comments have been resolved in the next PR, let me know if something is missing.

ToucheSir commented 1 year ago

I wasn't aware #256 was also working on the StackedRNN model. It would be preferable to merge those changes here so that PR stays more focused on the InceptionTime. If not, we can just close this one and focus on that one (I'm interpreting your comment to mean that the changes in #256 completely subsume this PR).

codeboy5 commented 1 year ago

I wasn't aware #256 was also working on the StackedRNN model. It would be preferable to merge those changes here so that PR stays more focused on the InceptionTime. If not, we can just close this one and focus on that one (I'm interpreting your comment to mean that the changes in #256 completely subsume this PR).

PR #256 does contain the code changes in this PR, since I created that branch from this branch. Other than that, just some renaming that's done there, etc. If we merge this, would those commits not be committed in that PR (since those commits are already committed to the master branch ) ? Specifically Commits from added RNN Model to updated notebook. If yes, we can merge this and then merge that one. Otherwise we can close this and merge that one.

ToucheSir commented 1 year ago

You'd likely have to rebase #256 after merging this PR if you've made changes to the same functions/types in that one. If that doesn't sound like a problem, we can merge this first.

codeboy5 commented 1 year ago

You'd likely have to rebase #256 after merging this PR if you've made changes to the same functions/types in that one. If that doesn't sound like a problem, we can merge this first.

Wouldn't be an issue. 👍🏻