Skip to content

Commit

Permalink
Potential fix for timeout errors in unit tests
Browse files Browse the repository at this point in the history
It seems there is a problem with one of the unit tests that explicitly rely on timeouts. Removing this test to avoid these issues in builds.

Signed-off-by: Patrick Bloebaum <bloebp@amazon.com>
  • Loading branch information
bloebp committed Dec 11, 2023
1 parent 4bb4a43 commit 20cfd23
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions tests/gcm/test_shapley.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
import signal

import numpy as np
import pytest
Expand Down Expand Up @@ -222,26 +221,6 @@ def model(x):
assert shapley_values_1 == approx(shapley_values_2, abs=0)


@flaky(max_runs=2)
def test_given_many_features_when_estimate_shapley_values_with_early_stopping_then_returns_before_reaching_max_number_permutations():
X, coefficients = _generate_data(3)

def model(x):
return np.max(x, axis=1)

def handler(a, b):
raise TimeoutError()

signal.signal(signal.SIGALRM, handler)
signal.alarm(10)

estimate_shapley_values(
lambda subset: _set_function_for_aggregated_feature_attribution(subset, X, model, False),
X.shape[1],
ShapleyConfig(approximation_method=ShapleyApproximationMethods.EARLY_STOPPING, num_permutations=np.inf),
)


def _generate_data(num_vars):
return np.random.normal(0, 1, (1000, num_vars)), np.random.choice(20, num_vars) - 10

Expand Down

0 comments on commit 20cfd23

Please sign in to comment.