bnelearn.tests.test_samplers.test_correlated_pv module

This pytest test file checks whether valuation and observation samplers have the expected behavior.

bnelearn.tests.test_samplers.test_correlated_pv.check_validity(valuation_profile, expected_shape, expected_mean, expected_std, expected_correlation=None)[source]

Checks whether a given batch of profiles has expected shape, mean, std and correlation matrix.

bnelearn.tests.test_samplers.test_correlated_pv.check_validity_of_conditional_sampler(sampler: CorrelatedSymmetricUniformPVSampler, n_players, valuation_size, u_lo, u_hi)[source]

Check runtime at minimum, maximum, midpoint inputs, as well as shapes, devices and known entries.

bnelearn.tests.test_samplers.test_correlated_pv.correlation(valuation_profile)[source]

Pearson correlation between valuations of bidders.

valuation_profile should be (batch x n_players x 1)

bnelearn.tests.test_samplers.test_correlated_pv.test_correlated_Bernoulli_weight_pv(n_players, valuation_size, gamma, u_lo, u_hi)[source]

Functionality and correctness test of the Bernoulli Weights sampler. We test

  • correctness of sample on standard device with standard batch_size

    • dimensions and output devices

    • ipv, i.e. valuations == observations

    • correctness of mean, std (where known) of marginals

    • correlation matrix

  • conditioned sampling on one player’s observation

    • has correct shapes and devices

    • has correct entries for the given player

    • otherwise looks like a valid sample

  • additionally, we test dimensions and output devices for manually specified devises or batch_sizes.

bnelearn.tests.test_samplers.test_correlated_pv.test_correlated_constant_weight_pv(n_players, valuation_size, gamma, u_lo, u_hi)[source]

Functionality and correctness test of the Constant Weights sampler. We test

  • correctness of sample on standard device with standard batch_size * dimensions and output devices * ipv, i.e. valuations == observations * correctness of mean, std (where known) of marginals * correlation matrix

  • conditioned sampling on one player’s observation * has correct shapes and devices * has correct entries for the given player * otherwise looks like a valid sample

  • additionally, we test dimensions and output devices for manually specified devises or batch_sizes.