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

I have some question about the input and output #9

Open
chendiva opened this issue Jul 29, 2020 · 20 comments
Open

I have some question about the input and output #9

chendiva opened this issue Jul 29, 2020 · 20 comments

Comments

@chendiva
Copy link

Hi there,
So I am now using a time series data which only have two columns- Date and Price. So I am wondering if I can use this algorithm in this situation, and let the algorithm train the model only on price, and predict the price in the future. In other words,
I am wondering if this model can separate my data automatically, so that I will not need to separate by "lag" myself. Thank you for your help!

@kdgutier
Copy link
Owner

kdgutier commented Jul 29, 2020 via email

@chendiva
Copy link
Author

Hi,
Will it affect the forecasting result when I add the exogenous variable?

@kdgutier
Copy link
Owner

kdgutier commented Jul 29, 2020 via email

@chendiva
Copy link
Author

Sorry , I am still confused, if I add the exogenous variable as you recommend, will it affect the result? Is the x variable in your example added by you? Or this x is originally included in the dataset and use for forecasting?

@kdgutier
Copy link
Owner

kdgutier commented Jul 29, 2020 via email

@chendiva
Copy link
Author

This also give me NaN for my y_hat

@kdgutier
Copy link
Owner

kdgutier commented Jul 30, 2020 via email

@chendiva
Copy link
Author

Hi, how can I decide the frequency then?

@kdgutier
Copy link
Owner

kdgutier commented Jul 30, 2020 via email

@chendiva
Copy link
Author

I actually use my dataset, not the M3 now. My dataset is daily base. so I set the frequency = 'D', but I then got the error like this:
image

@kdgutier
Copy link
Owner

kdgutier commented Jul 30, 2020 via email

@chendiva
Copy link
Author

Yes, I actually check the dataframe with this command: df.isnull().values.any(), which returns me False. But I still get the above result

@kdgutier
Copy link
Owner

kdgutier commented Jul 30, 2020 via email

@kdgutier
Copy link
Owner

kdgutier commented Jul 30, 2020 via email

@Yu-1245
Copy link

Yu-1245 commented Jul 31, 2020

Hi, there, I got the same problem with yours, have you solved it? I tried to slice the m4 data provided from the prepare_m4_data function, and found out that even I make sure the identifier in the training set and testing set are the same, it still generated NaN for the evaluation methods and the predictions, which was weird.

@AzulGarza
Copy link
Collaborator

Hi!

I think this answer could be useful.

@Yu-1245
Copy link

Yu-1245 commented Jul 31, 2020

Hi,
I saw the answer you. I have checked my dataset and make the changed you mentioned, but it still generate NaN for me.
@FedericoGarza

@chendiva
Copy link
Author

Hi, there, I got the same problem with yours, have you solved it? I tried to slice the m4 data provided from the prepare_m4_data function, and found out that even I make sure the identifier in the training set and testing set are the same, it still generated NaN for the evaluation methods and the predictions, which was weird.

No, I haven't solved the problem yet, even I tried his method.

@Worben
Copy link

Worben commented Aug 23, 2020

Hi,
I have the same problem with my dataset. When I tried to find out the reason, I figured out that the NaN values appears for the first time in the long_to_wide function, more precisely: in the for loop. Any idea how to solve this? my data is structured exactly according to the specifications

def long_to_wide(self, X_df, y_df):
data = X_df.copy()
data['y'] = y_df['y'].copy()
sorted_ds = np.sort(data['ds'].unique())
ds_map = {}
for dmap, t in enumerate(sorted_ds):
	ds_map[t] = dmap
data['ds_map'] = data['ds'].map(ds_map)
data = data.sort_values(by=['ds_map','unique_id'])
df_wide = data.pivot(index='unique_id', columns='ds_map')['y']

x_unique = data[['unique_id', 'x']].groupby('unique_id').first()
last_ds =  data[['unique_id', 'ds']].groupby('unique_id').last()
assert len(x_unique)==len(data.unique_id.unique())
df_wide['x'] = x_unique
df_wide['last_ds'] = last_ds
df_wide = df_wide.reset_index().rename_axis(None, axis=1)

ds_cols = data.ds_map.unique().tolist()
X = df_wide.filter(items=['unique_id', 'x', 'last_ds']).values
y = df_wide.filter(items=ds_cols).values

return X, y

Repository owner deleted a comment from chendiva Sep 4, 2020
Repository owner deleted a comment from chendiva Sep 4, 2020
Repository owner deleted a comment from chendiva Sep 4, 2020
@kdgutier
Copy link
Owner

kdgutier commented Sep 4, 2020

Have you solved the issue Worben?

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

5 participants