Hi everyone, I have a question where I can't get a...
# neural-forecast
s
Hi everyone, I have a question where I can't get any further with the documentation. My training data set consists of three columns: unique_id, ds and y. I have 192 rows per unique_id and I want to pass 96 as input_size and 96 as horizon to my model. It looks like this: lstm_config = AutoLSTM.get_default_config(h=96, backend="ray") lstm_config["input_size"] = 96 lstm_config["context_size"] = 96 levels = [80, 90] model = AutoLSTM(h=96, loss=MQLoss(level=[80, 90]), config=lstm_config, gpus=1, search_alg=HyperOptSearch(), backend='ray', num_samples=32) loaded_nf = NeuralForecast(models=[model], freq='15min') train_data, test_data = load_and_preprocess_data(file_path) loaded_nf.fit(df=train_data, val_size=96) With this setup: I get the error 'No window available for training', which I don't understand, as there are exactly the right number of lines per unique_id for input_size + horizon. I have now realised that I can prevent the error if I set the parameter 'start_padding_enabled' to True. I could actually be happy with this, but I'm worried that any padding that is carried out will severely degrade my training data. I therefore have the following question: Why do I have to set the parameter 'start_padding_enabled' to True in my setup for it to work and what might be padded here?
m
Hello! It's because for hyperparameter tuning, you need some validation set. By setting the input length to half the series, and the horizon to the other half, you leave no data for validation (so hyperparameter tuning cannot run). What padding does is that it will pad the start of the series with 0 so that we leave some room for training and validation. In this case, there are 3 options: 1. Use padding like you did (it might affect performance) 2. Reduce the input length and horizon (might not be doable depending on the use case) 3. Get more data (ideal, but I understand if it's not doable) I hope this helps!
s
Thank you! That really helps a lot :)
I have one more question on this topic: Is there a way to find out how many data points are being padded at the start of the series? I am asking this question because I have also noticed that the error "No window available..." does not occur if I set input_size and horizon to 95, leave val_size at 96 and my training data still has 192 rows per unique_id. From this I conclude that in this case the remaining 2 rows (192 - 95 - 95 = 2) are used for validation. However, if I take 96 as input_size and horizon and set start_padding_enabled to True, would a whole 96 "new" rows out of zeroes be added by padding (because val_size=96)? Or how can I find out?
m
The padding logic is explained here:
Copy code
# Padder to complete train windows,
        # example y=[1,2,3,4,5] h=3 -> last y_output = [5,0,0]
        if start_padding_enabled:
            self.padder_train = nn.ConstantPad1d(
                padding=(self.input_size - 1, self.h), value=0.0
            )
        else:
            self.padder_train = nn.ConstantPad1d(padding=(0, self.h), value=0.0)
s
Thank you very much! As I have seen in the code, padding is also done with start_padding_enabled=False at the end of the time series. The parameter only determines whether padding takes place at the beginning or not. With this knowledge, I again do not understand why the case input_size = 96, horizon = 96 and val_size = 96 does not work. Since padding is always allowed at the end with the length of the horizon, it should leave enough data for validation in my understanding. In the second case, input_size = 95, horizon = 95 and val_size = 96, it seems to work with padding at the end (because in this case I didn't have to set start_padding_enabled to True for the case to work). Unfortunately I didn't find much more about the val_size parameter than that it is set to horizon if it is not specified, maybe this is where my comprehension problem lies. But to finalise: it would be best in my case, according to what I found out, if my time series were not 192 but 288 rows long (96 for input_size, 96 for horizon and 96 for val_size)?
m
For sure that if you can provide longer series for training, it would be better, yes!