timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.14k stars 643 forks source link

Tests appear to have off-label results (regression models) #823

Closed tianlongyang-bot closed 11 months ago

tianlongyang-bot commented 1 year ago

Hi, I'm using tsai and it's really good, but I've met some problems, when I train with InceptionTimePlus network, the training set labels are between [0,1], and the test set results can be greater than 1 or negative, I don't want this kind of result, what is the reason for that? Or can I change the output classifier? For example, logistic regression

oguiza commented 1 year ago

Hi @tianlongyang-bot, That's strange. tsai can automatically detect the label type. Are you passing floats or ints as inputs? If you want the problem handled as a regression task make sure you pass floats, even if it's 1.0, 3.0, etc.

tianlongyang-bot commented 1 year ago

tfms = [None,[TSRegression()]] train_y = train_y.astype("float32") test_y = test_y.astype("float32")

Hi @oguiza, Thanks for your reply, I am using a floating point type and using a regression model for life prediction, his labels are distributed between 0 and 1,1for full life and 0 for life depletion, so the labels will be 0.34,0.88, etc. The training set labels are all in [0,1]. But when testing the data the prediction will be outside of [0,1].I just want to do the regression task with results between [0,1].What should I do?

oguiza commented 1 year ago

Hi @tianlongyang-bot, The simplest approach would be to clip your data between 0 and 1. Alternatively, some models contain a yrange parameter that you can set to [0, 1]. This will clip data while training the model. But it's not available on all models.