Rename shapley unit tests
Signed-off-by: Patrick Bloebaum <bloebp@amazon.com>
This commit is contained in:
Родитель
7f4640f368
Коммит
86e0b1c78d
|
@ -19,7 +19,7 @@ def preserve_random_generator_state():
|
|||
random.setstate(random_state)
|
||||
|
||||
|
||||
def test_given_few_features_when_estimate_shapley_values_with_auto_approx_then_returns_correct_result():
|
||||
def test_given_few_features_when_estimate_shapley_values_with_auto_approx_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(4)
|
||||
|
||||
def model(x):
|
||||
|
@ -34,7 +34,7 @@ def test_given_few_features_when_estimate_shapley_values_with_auto_approx_then_r
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_given_many_features_when_estimate_shapley_values_with_auto_approx_then_returns_correct_result():
|
||||
def test_given_many_features_when_estimate_shapley_values_with_auto_approx_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -49,7 +49,7 @@ def test_given_many_features_when_estimate_shapley_values_with_auto_approx_then_
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_exact():
|
||||
def test_given_many_features_when_estimate_shapley_values_exact_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -64,7 +64,7 @@ def test_estimate_shapley_values_symmetry_exact():
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_exact_fast():
|
||||
def test_given_many_features_when_estimate_shapley_values_exact_fast_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -79,7 +79,7 @@ def test_estimate_shapley_values_symmetry_exact_fast():
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_approximation_via_subset():
|
||||
def test_given_many_features_when_estimate_shapley_values_with_subset_sampling_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -94,7 +94,7 @@ def test_estimate_shapley_values_symmetry_approximation_via_subset():
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_evaluate_set_function_via_shapley_symmetry_approximation_via_permutation():
|
||||
def test_given_many_features_when_estimate_shapley_values_permutation_based_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -109,7 +109,7 @@ def test_evaluate_set_function_via_shapley_symmetry_approximation_via_permutatio
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_approximation_via_early_stopping():
|
||||
def test_given_many_features_when_estimate_shapley_values_with_early_stopping_then_returns_correct_linear_shapley_values():
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -124,7 +124,9 @@ def test_estimate_shapley_values_symmetry_approximation_via_early_stopping():
|
|||
assert coefficients * (X[0, :] - np.mean(X, axis=0)) == approx(shapley_values, abs=0.001)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_approximation_via_subset_with_random_seed(preserve_random_generator_state):
|
||||
def test_given_specific_random_seed_when_estimate_shapley_values_with_subset_sampling_then_returns_deterministic_result(
|
||||
preserve_random_generator_state,
|
||||
):
|
||||
X, coefficients = _generate_data(15)
|
||||
|
||||
def model(x):
|
||||
|
@ -155,7 +157,7 @@ def test_estimate_shapley_values_symmetry_approximation_via_subset_with_random_s
|
|||
|
||||
|
||||
@flaky(max_runs=2)
|
||||
def test_estimate_shapley_values_symmetry_approximation_via_permutation_with_random_seed(
|
||||
def test_given_specific_random_seed_when_estimate_shapley_values_permutation_based_then_returns_deterministic_result(
|
||||
preserve_random_generator_state,
|
||||
):
|
||||
X, coefficients = _generate_data(15)
|
||||
|
@ -187,7 +189,7 @@ def test_estimate_shapley_values_symmetry_approximation_via_permutation_with_ran
|
|||
assert shapley_values_1 == approx(shapley_values_2, abs=0)
|
||||
|
||||
|
||||
def test_estimate_shapley_values_symmetry_approximation_via_early_stopping_with_random_seed(
|
||||
def test_given_specific_random_seed_when_estimate_shapley_values_with_early_stopping_then_returns_deterministic_result(
|
||||
preserve_random_generator_state,
|
||||
):
|
||||
X, coefficients = _generate_data(15)
|
||||
|
|
Загрузка…
Ссылка в новой задаче