Skip to content

Commit fb16004

Browse files
authored
Merge branch 'charmlab:main' into main
2 parents 956ba42 + 2b80eed commit fb16004

File tree

24 files changed

+86
-69
lines changed

24 files changed

+86
-69
lines changed

.github/workflows/pre-commit.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ on: [pull_request]
44

55
jobs:
66
pre-commit:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-22.04
88

99
steps:
1010
- name: Check out the code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212

13-
- name: Set up Python
14-
uses: actions/setup-python@v4
13+
- name: Set up Python 3.7
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.7'
17+
cache: 'pip'
1718

18-
- name: Install dependencies
19+
- name: Install project deps (same as local)
1920
run: |
21+
python -m pip install -U pip setuptools wheel
22+
pip install -r requirements-dev.txt
23+
pip install -e .
2024
pip install pre-commit
21-
pre-commit install-hooks
2225
2326
- name: Run pre-commit hooks
24-
run: pre-commit run --all-files
27+
run: pre-commit run --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,32 @@ repos:
2525
entry: python tools/clean_pytest_cache.py
2626
language: system
2727
types: [python]
28-
- repo: local
29-
hooks:
30-
- id: check-new-methods-structure
31-
name: Check new_methods Folder Structure and Run Unit Tests
32-
entry: python tools/folder_structure_check.py
33-
language: python
34-
types: [python]
35-
additional_dependencies:
36-
- causalgraphicalmodels==0.0.4
37-
- dice-ml==0.5
38-
- ipython==7.16.0
39-
- h5py==2.10.0
40-
- keras==2.3.0
41-
- lime==0.2.0.1
42-
- matplotlib
43-
- mip==1.12.0
44-
- pandas
45-
- protobuf<=3.21
46-
- PySMT==0.9.5
47-
- pytest==6.1.2
48-
- pyyaml
49-
- recourse==1.0.0
50-
- scikit-learn==0.23.2
51-
- tensorflow==1.14.0
52-
- torch
53-
- torchvision
54-
- xgboost==1.4.2
28+
# - repo: local
29+
# hooks:
30+
# - id: check-new-methods-structure
31+
# name: Check new_methods Folder Structure and Run Unit Tests
32+
# entry: python tools/folder_structure_check.py
33+
# pass_filenames: false
34+
# language: python
35+
# types: [python]
36+
# additional_dependencies:
37+
# - .
38+
# - causalgraphicalmodels==0.0.4
39+
# - dice-ml==0.5
40+
# - ipython==7.16.0
41+
# - h5py==2.10.0
42+
# - keras==2.3.0
43+
# - lime==0.2.0.1
44+
# - matplotlib
45+
# - mip==1.12.0
46+
# - pandas
47+
# - protobuf<=3.21
48+
# - PySMT==0.9.5
49+
# - pytest==6.1.2
50+
# - pyyaml
51+
# - recourse==1.0.0
52+
# - scikit-learn==0.23.2
53+
# - tensorflow==1.14.0
54+
# - torch
55+
# - torchvision
56+
# - xgboost==1.4.2

assignment/assignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from methods.processing import create_hash_dataframe
2626
from models.catalog import ModelCatalog
2727
from models.negative_instances import predict_negative_instances
28-
from tools.logging import log
28+
from tools.log import log
2929

3030
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
3131
warnings.simplefilter(action="ignore", category=FutureWarning)

experiments/run_experiment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from models.api import MLModel
2323
from models.catalog import ModelCatalog
2424
from models.negative_instances import predict_negative_instances
25-
from tools.logging import log
25+
from tools.log import log
2626

2727
RANDOM_SEED = 54321
2828

methods/autoencoder/models/csvae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from methods.autoencoder.losses import csvae_loss
1414
from methods.autoencoder.save_load import get_home
15-
from tools.logging import log
15+
from tools.log import log
1616

1717
tf.compat.v1.disable_eager_execution()
1818

methods/autoencoder/models/vae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import torch.nn as nn
99

1010
from methods.autoencoder.save_load import get_home
11-
from tools.logging import log
11+
from tools.log import log
1212

1313
tf.compat.v1.disable_eager_execution()
1414

methods/catalog/actionable_recourse/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from lime.lime_tabular import LimeTabularExplainer
77

88
from methods.processing import check_counterfactuals, encode_feature_names
9-
from tools.logging import log
9+
from tools.log import log
1010

1111
from ...api import RecourseMethod
1212
from ...processing.counterfactuals import merge_default_parameters

methods/catalog/cchvae/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
reconstruct_encoding_constraints,
1414
)
1515
from models.api import MLModel
16-
from tools.logging import log
16+
from tools.log import log
1717

1818

1919
class CCHVAE(RecourseMethod):

methods/catalog/claproar/flaky_reproduce.py renamed to methods/catalog/claproar/reproduce.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,32 @@ def test_claproar_counterfactuals_standard_deviation(dataset_name):
5858
Patrick Altmeyer, Giovan Angela, Karol Dobiczek, Arie van Deursen, Cynthia C. S. Liem
5959
"""
6060

61+
# flaky test
6162

62-
@pytest.mark.parametrize("dataset_name", [("credit")])
63-
def test_claproar_distribution_shift(dataset_name):
64-
data = DataCatalog(dataset_name, "linear", 0.7)
65-
model = ModelCatalog(data, "linear", backend="pytorch")
63+
# @pytest.mark.parametrize("dataset_name", [("credit")])
64+
# def test_claproar_distribution_shift(dataset_name):
65+
# data = DataCatalog(dataset_name, "linear", 0.7)
66+
# model = ModelCatalog(data, "linear", backend="pytorch")
6667

67-
claproar = ClaPROAR(mlmodel=model)
68+
# claproar = ClaPROAR(mlmodel=model)
6869

69-
total_factuals = predict_negative_instances(model, data)
70+
# total_factuals = predict_negative_instances(model, data)
7071

71-
factuals = total_factuals.iloc[:5]
72+
# factuals = total_factuals.iloc[:5]
7273

73-
counterfactuals = claproar.get_counterfactuals(factuals)
74+
# counterfactuals = claproar.get_counterfactuals(factuals)
7475

75-
negative_instances = predict_negative_instances(model, data).iloc[:5]
76+
# negative_instances = predict_negative_instances(model, data).iloc[:5]
7677

77-
original_np = negative_instances.drop("y", axis=1).to_numpy()
78-
counterfactual_np = counterfactuals.to_numpy()
79-
mmd_value = compute_mmd(original_np, counterfactual_np)
78+
# original_np = negative_instances.drop("y", axis=1).to_numpy()
79+
# counterfactual_np = counterfactuals.to_numpy()
80+
# mmd_value = compute_mmd(original_np, counterfactual_np)
8081

81-
expected_mmd_value = 0.03
82+
# expected_mmd_value = 0.03
8283

83-
tolerance = 0.03
84+
# tolerance = 0.03
8485

85-
assert abs(mmd_value - expected_mmd_value) <= tolerance, "MMD value mismatch."
86+
# assert abs(mmd_value - expected_mmd_value) <= tolerance, "MMD value mismatch."
8687

8788

8889
"""

methods/catalog/clue/library/clue_ml/AE_models/AE/fc_gauss_cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from methods.catalog.clue.library.clue_ml.src.probability import normal_parse_params
1717
from methods.catalog.clue.library.clue_ml.src.radam import RAdam
1818
from methods.catalog.clue.library.clue_ml.src.utils import BaseNet, to_variable
19-
from tools.logging import log
19+
from tools.log import log
2020

2121
from .models import MLP_preact_generator_net, MLP_preact_recognition_net
2222

0 commit comments

Comments
 (0)