-
Notifications
You must be signed in to change notification settings - Fork 5
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
replaces randsample
with a custom-built randSample
function and removes range
#324
replaces randsample
with a custom-built randSample
function and removes range
#324
Conversation
3d94b20
to
90dab94
Compare
90dab94
to
65df06f
Compare
randsample
with a custom-built randSample
functionrandsample
with a custom-built randSample
function and removes range
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.
Looks good, there are just a couple of things I'd like you to have a look at please.
I don't think argument blocks work at all prior to 2022b unfortunately. |
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.
All looks good, shame about the arguments block.
This PR fixes part of #146 by removing the use of
range
fromhistp.m
and replacingrandsample
from the Statistical Toolbox with a home-made implementation.Note that of the six potential operations of
randsample
, this only implements four:randsample(n, k)
randSample(n, k)
(samplek
random integers between 1 andn
without replacement)randsample(population, k)
randSample(population, k)
(samplek
random items frompopulation
without replacementrandsample(n, k, true, w)
randSample(n, k, w)
(samplek
random integers between 1 andn
with replacement, with weightsw
)randsample(population, k, true, w)
randSample(population, k, w)
(samplek
random items frompopulation
with replacement, with weightsw
)It seems that we never do unweighted sampling with replacement, and randsample does not support weighted sampling without replacement, so I did away with the
replacement
parameter inrandsample
.