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

time series classification question #910

Open
ChaohuanDeng123 opened this issue Jun 22, 2024 · 1 comment
Open

time series classification question #910

ChaohuanDeng123 opened this issue Jun 22, 2024 · 1 comment

Comments

@ChaohuanDeng123
Copy link

For time series classification tasks, if there is an imbalance in the data among categories, such as three categories where one category greatly outnumbers the others, how should I handle it? For example, by modifying the loss function to assign different weights to different categories. How should I modify the following code?
model = TST(dls.vars, dls.c, dls.len, dropout=.3, fc_dropout=.8).to(device) learn = Learner(dls, model, loss_func=LabelSmoothingCrossEntropyFlat(),metrics=[accuracy], cbs=ShowGraphCallback2()) start = time.time() learn.fit_one_cycle(50, lr_max=1e-4) print('\nElapsed time:', time.time() - start) learn.plot_metrics()

@mesner
Copy link

mesner commented Sep 20, 2024

I've had decent success with https://docs.fast.ai/losses.html#focalloss

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