pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

% values were found to be NA or infinite (even after encoding)

Open cjing1 opened this issue 3 years ago • 3 comments

Screenshot 2022-12-13 at 7 56 13 PM

ValueError: 22411 (65.81%) of vader_com_event_sum values were found to be NA or infinite (even after encoding). NA values are not allowed allow_missing_timesteps refers to missing rows, not to missing values. Possible strategies to fix the issue are (a) dropping the variable vader_com_event_sum, (b) using NaNLabelEncoder(add_nan=True) for categorical variables, (c) filling missing values and/or (d) optionally adding a variable indicating filled values.

I received the above error, but I checked none of the values is NA or Inf. And vader_com_event_sum is my target variable. May I ask for a further explanation of the fixed strategies?

Thank you so much for any help or suggestions.

cjing1 avatar Dec 14 '22 01:12 cjing1

I find out the reason. It is due to the softplus transformation, which creates NA and Inf. I think I can fix it if I with a shift, e.g. scale = 1e-5 + softplus(unconstrained_scale). However, may I ask how should I implement it in the TimeSeriesDataSet argument?

cjing1 avatar Dec 14 '22 05:12 cjing1

Facing the same Issue.

vaishnavnegi avatar Jan 26 '23 18:01 vaishnavnegi

You probably have some negative values in your dataset, which makes softplus transformation produce negative infinities. I would probably just shift the whole feature so that there are no more negative values if you'd like to keep the softplus transformation.

abudis avatar Nov 07 '23 10:11 abudis