Skip to content

Commit

Permalink
Merge pull request #243 from AI-SDC/development
Browse files Browse the repository at this point in the history
merge dev into main
  • Loading branch information
rpreen authored Oct 19, 2023
2 parents 18999dc + f46547c commit 910da74
Show file tree
Hide file tree
Showing 17 changed files with 1,665 additions and 600 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: "v2.2.2"
rev: "v2.3.0"
hooks:
- id: pycln
stages: [manual]
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 1.1.1 (Oct 19, 2023)

Changes:
* Update notebook example paths ([#237](https://github.com/AI-SDC/AI-SDC/pull/237))
* Fix AdaBoostClassifier structural attack ([#242](https://github.com/AI-SDC/AI-SDC/pull/242))
* Move experiments module and configs to separate repository ([#229](https://github.com/AI-SDC/AI-SDC/pull/229))

## Version 1.1.0 (Oct 11, 2023)

Changes:
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cff-version: 1.2.0
title: AI-SDC
version: 1.1.0
doi: 10.5281/zenodo.8430143
date-released: 2023-10-11
version: 1.1.1
doi:
date-released: 2023-10-19
license: MIT
repository-code: https://github.com/AI-SDC/AI-SDC
languages:
Expand Down
25 changes: 17 additions & 8 deletions aisdc/attacks/structural_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,20 @@ def get_model_param_count(model: BaseEstimator) -> int:

if isinstance(model, DecisionTreeClassifier):
n_params = get_tree_parameter_count(model)
elif isinstance(model, RandomForestClassifier) or (
isinstance(model, AdaBoostClassifier)
and isinstance(model.estimator, DecisionTreeClassifier)
):

elif isinstance(model, RandomForestClassifier):
for member in model.estimators_:
n_params += get_tree_parameter_count(member)

elif isinstance(model, AdaBoostClassifier):
try: # sklearn v1.2+
base = model.estimator
except AttributeError: # sklearn version <1.2
base = model.base_estimator
if isinstance(base, DecisionTreeClassifier):
for member in model.estimators_:
n_params += get_tree_parameter_count(member)

# TO-DO define these for xgb, logistic regression, SVC and others
elif isinstance(model, XGBClassifier):
df = model.get_booster().trees_to_dataframe()
Expand Down Expand Up @@ -281,10 +289,11 @@ def attack(self, target: Target) -> None:
errstr = "len mismatch between equiv classes and "
assert len(equiv_classes) == len(equiv_counts), errstr + "counts"
assert len(equiv_classes) == len(equiv_members), errstr + "membership"
# print(f'equiv_classes is {equiv_classes}\n'
# f'equiv_counts is {equiv_counts}\n'
# #f'equiv_members is {equiv_members}\n'
# )
print(
f"equiv_classes is {equiv_classes}\n"
f"equiv_counts is {equiv_counts}\n"
# #f'equiv_members is {equiv_members}\n'
)

# now assess the risk
# Degrees of Freedom
Expand Down
290 changes: 0 additions & 290 deletions aisdc/experiments/run_experiments.py

This file was deleted.

Loading

0 comments on commit 910da74

Please sign in to comment.