Using num_samples = a value in the forecast code. Is there a way to know the indices of the random selection of the samples, and use the same exact samples' indices for another forecast? I don't want to reproduce the same results using random seeds. This is a different question. #2698
|
I have this simple code: Now, how to know which 20 samples the model picked? What are their indices and how to use the same indices to forecast another time? |
Replies: 5 comments
|
Hi @Msaleh87, Thank you for your question. I'm not sure I understand. What does an "index" that you talking about refer to? |
|
Let's say in the code above, I set num_samples = 3, then my understanding is that the forecast/ make_evaluation_predictions function will choose random 3 probabilistic paths for the future forecast and outcome the mean of them. Let's say the function picked sample paths 3,4,5 out of 100 possible future forecasts. |
|
Hi @Msaleh87, I think there might be a misunderstanding how sampling works. If you invoke Hope this was clear. |
|
Thanks so much for this clarification, it makes sense now, u saved me a lot of time! So I guess my question is: Is there a way to generate the same set of samples? Also, let's say I generate num_samples = 100. Can I access and select 0,1,2 samples, and how? Thanks so much for ur time and help |
|
Hi @Msaleh87, This is the object that the models with sampling return: gluonts/src/gluonts/model/forecast.py Line 423 in b0fb27f .samples attribute are the samples.
|
Hi @Msaleh87,
I think there might be a misunderstanding how sampling works. If you invoke
predict(which makes evaluation predictions) does under the hood, it will return a tensor where one dimension will be the sample dimension. If you havenum_samples=3, the size of this dimension is 3 (and the indices 0, 1, 2 accordingly). There is no mechanism of picking samples out of some larger set of samples. If you invokepredictagain the model will generate another set of samples.Hope this was clear.