diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2433f5..1e0e766 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-builtin-literals @@ -12,7 +12,7 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.3 + rev: v0.16.8 hooks: - id: ruff args: diff --git a/README.md b/README.md index 47c686d..7a3a2aa 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ model = ... imputer = sage.MarginalImputer(model, x[:128]) # Set up an estimator -estimator = sage.PermutationEstimator(imputer, 'mse') +estimator = sage.PermutationEstimator(imputer, "mse") # Calculate SAGE values sage_values = estimator(x, y) diff --git a/sage/kernel_estimator.py b/sage/kernel_estimator.py index 0df49b4..064d371 100644 --- a/sage/kernel_estimator.py +++ b/sage/kernel_estimator.py @@ -4,7 +4,7 @@ from sage import core, utils -def calculate_A(num_features): # noqa:N802 +def calculate_A(num_features): # ruff: ignore[invalid-function-name] """Calculate A parameter's exact form.""" p_coaccur = ( np.sum( diff --git a/sage/utils.py b/sage/utils.py index 4e340b2..506a927 100644 --- a/sage/utils.py +++ b/sage/utils.py @@ -36,8 +36,8 @@ def model_conversion(model): model.eval() device = next(model.parameters()).device - return ( - lambda x: model(torch.tensor(x, dtype=torch.float32, device=device)) + return lambda x: ( + model(torch.tensor(x, dtype=torch.float32, device=device)) .cpu() .data.numpy() )