-
Notifications
You must be signed in to change notification settings - Fork 820
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
Feat/stochastic inputs #833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1176,6 +1176,28 @@ def values(self, copy=True, sample=0) -> np.ndarray: | |
else: | ||
return self._xa.values[:, :, sample] | ||
|
||
def random_component_values(self, copy=True) -> np.array: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about an additional optional to randomly sample a quantile per sample? I would assume this is similar to quantile regression based on stochastic input (without needing QuantileRegression as a likelihood) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, you mean returning the exact quantile instead of sampling a sample at random? That's an interesting idea :) But would require a bit of adaptation elsewhere as we would still need to ensure this is applied on the output targets only, and not e.g. on the inputs or covariates. Let's keep the idea though. |
||
""" | ||
Return a 2-D array of shape (time, component), containing the values for | ||
one sample taken uniformly at random among this series' samples. | ||
|
||
Parameters | ||
---------- | ||
copy | ||
Whether to return a copy of the values, otherwise returns a view. | ||
Leave it to True unless you know what you are doing. | ||
|
||
Returns | ||
------- | ||
numpy.ndarray | ||
The values composing one sample taken at random from the time series. | ||
""" | ||
sample = np.random.randint(low=0, high=self.n_samples) | ||
if copy: | ||
return np.copy(self._xa.values[:, :, sample]) | ||
else: | ||
return self._xa.values[:, :, sample] | ||
|
||
def all_values(self, copy=True) -> np.ndarray: | ||
""" | ||
Return a 3-D array of dimension (time, component, sample), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nitpicking but isn't there a slim chance that the predictions will be identical? :D we could add a seed to make sure they are not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, normally there is a seed earlier in the file which I believe should apply here :)