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

Fix some issues with sampling #879

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Fix some issues with sampling #879

wants to merge 5 commits into from

Commits on Jul 5, 2023

  1. Unify argument checking for sampling and check more cases

    Currently sampling functions need to perform the same set of checks on
    the inputs and those checks are copied and pasted for each method. We
    can instead define a simple input validation function that can be used
    by all sampling functions so that any additional corner cases that need
    to be caught can be fixed in one place and propagated elsewhere.
    
    Relatedly, this adds checks for agreement between the length of the
    source array to be sampled and the array of weights (issue 871) as well
    as that the destination array is not larger than the source when
    sampling without replacement (issue 877).
    ararslan committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    6c4c119 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d8dfe60 View commit details
    Browse the repository at this point in the history
  3. Don't access weight vector .values unnecessarily

    Not all `AbstractWeights` subtypes have that field, e.g. `UnitWeights`,
    but all have indexing defined, so that can be used instead of trying to
    index into the underlying array.
    ararslan committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    d56a40a View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2023

  1. Improve error message

    Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
    ararslan and nalimilan committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    4a1e261 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    faa481f View commit details
    Browse the repository at this point in the history