feat: new instance-based attack for data leakage in SVM/kNN models#431
feat: new instance-based attack for data leakage in SVM/kNN models#431shamykyzer wants to merge 20 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #431 +/- ##
==========================================
+ Coverage 99.65% 99.66% +0.01%
==========================================
Files 27 28 +1
Lines 3439 3632 +193
==========================================
+ Hits 3427 3620 +193
Misses 12 12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a901e02 to
da9ed7d
Compare
There was a problem hiding this comment.
@shamykyzer Just a couple of minor changes to make please.
If you want to raise the 'move dealing with pipelines into utils.py' as a separate issue, and leave that code in here for now that is fine.
|
Hi @jim-smith, could you please review this PR so far? thanks a lot. |
- add report_individual option, gated like StructuralAttack so the per-record block only appears under the 'individual' key when set - record all matched instances (n_examples now limits PDF display only) - replace bespoke example_matches with an InstanceBasedRecordLevelResults dataclass of parallel lists, consistent with other attacks - give InstanceBasedAttackResults field defaults to trim the graceful-degradation construction sites
# Conflicts: # CHANGELOG.md
jim-smith
left a comment
There was a problem hiding this comment.
Still needs changes. I think the way it is implemented is possibly more efficient and the overall message "does this mode lcintain training instances' is answered correctly.
However, the way that the record level results are presented (is this stored instance present in the training set) is inconsistent with the way it is presented for other attacks (which would be 'is this training record stored in the model'. Quick change to create a new field,
individual_risk:np.array = np.zeros(X_train.shape[0],dtype=int) and then a for loop setting to 1 (True) the index of training record you have stored in individual level results
InstanceBasedAttackdetects training data leakage in models that store raw instances, support vectors (SVC,NuSVC,OneClassSVM) and stored neighbours (KNeighborsClassifier,KNeighborsRegressor)np.allclose, reports first ten matches with feature previews, plus storage fraction and match fraction metricssklearn.Pipelineso the comparison runs in the final estimator's feature space"instance_based"INSTANCE_MATCH_ATOL = 1e-8,N_EXAMPLES = 10,N_FEATURE_PREVIEW = 10Closes [New Feature Request] New Attack: Model contains training data#59
Closes #454