Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example-based #165

Closed
wants to merge 146 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
c8df34e
example-based: add cole method
AdelinCO May 29, 2023
c331801
tests: unit testing cole
AdelinCO May 29, 2023
e1e4d82
example based: introduce projections
May 29, 2023
eda3317
example based: introduce search methods
May 29, 2023
4b0a340
example based: add base class
May 29, 2023
0daf281
cole: update and improve
Feb 14, 2024
62a621d
example based tests: update and complete
May 29, 2023
2aa133d
plots: add image visualization for example based
Feb 14, 2024
bed4747
commons: add operations for tf dataset
Feb 14, 2024
9f9acfb
pylint: disable similarities for signatures
Feb 14, 2024
d29f92f
example based: introduce base example method abstraction
Feb 12, 2024
69fef12
example based: adapt similar examples
Feb 12, 2024
539c387
example based: adapt cole
Feb 12, 2024
7a58c9f
example based: adapt tests
Feb 12, 2024
2255896
base example method: dataset projections in projections
Feb 14, 2024
ead19ea
base projection: dataset projections in projections
Feb 14, 2024
48bc853
latent space projection: dataset projections in projections
Feb 14, 2024
fcacfd1
attribution projection: dataset projections in projections
Feb 14, 2024
4dbb6b6
example based: introduce hadamard projection
Feb 14, 2024
6e8ddb1
base search method: remove projection from search
Feb 14, 2024
5abb298
knn search method: remove projection from search
Feb 14, 2024
92056f1
cole: add hadamard product possibility
Feb 14, 2024
3f69e7b
projections: factorize model splitting
Feb 14, 2024
5cdf1c1
example based projections: fuse custom projection with base class
Feb 28, 2024
0c141bb
projections tests: adapt to changes and complete
Feb 14, 2024
56ddd00
similar examples tests: adapt to changes
Feb 14, 2024
c44d256
cole tests: adapt to changes and add hadamard
Feb 14, 2024
445fce1
tf operations: add get device for dataset mapping
Feb 15, 2024
7cfa2f3
feat: add a new KNN object and improve distance computation efficiency
lucashervier Mar 6, 2024
52d1c6a
tests: add tests for KNNs
lucashervier Mar 6, 2024
939bbc8
feat: develop the naive semi factual, update search methods for integ…
lucashervier Mar 7, 2024
8d9f234
feat: add a semi factuals method that is dedicated to one specific label
lucashervier Mar 7, 2024
f5f05a3
feat: add a naive counter factuals methods and its test
lucashervier Mar 13, 2024
7b32df9
add Prototypes
ChafikBak Mar 21, 2024
a86fd55
add Prototypes fix up
ChafikBak Mar 21, 2024
d705573
add Prototypes fix up
ChafikBak Apr 4, 2024
4649436
add Prototypes fix up
ChafikBak Apr 30, 2024
a62fd8e
add Prototypes fix up
ChafikBak Apr 30, 2024
e839e24
feat: change the private initialize_cases_dataset method to a protec…
lucashervier May 21, 2024
b3ebe4a
feat: change the fill value to np.inf when gathering elements of a da…
lucashervier May 21, 2024
335dcb9
feat: add the kleor search methods and their tests
lucashervier May 21, 2024
fe5cc44
feat: add the possibilities as an initialisation args
lucashervier May 21, 2024
67b7804
feat: add the KLEOR example based method and its tests
lucashervier May 21, 2024
c6be204
feat: add the kleor method in the package init
lucashervier May 21, 2024
aa9a500
fix: change the set_returns and set_k methods to properties with a se…
lucashervier May 21, 2024
7d49cfd
example based: merge contrastive
May 22, 2024
9d5062e
example based: merge and solve part of problems and refacto
May 22, 2024
026c29e
fix: change the fill value depending on the dataset type
lucashervier May 22, 2024
31bb022
fix: update kleor search and example base methods to fit the new inte…
lucashervier May 22, 2024
19d7cb3
example based: cole tests pass
May 23, 2024
122f8d5
docs: refactoring of the documentation for the new interfaces
lucashervier May 29, 2024
7a66525
add the documentation for the prototypes search methods
ChafikBak Jul 3, 2024
c8047b0
prototypes: hotfix
Jul 8, 2024
693fa42
prototypes: hotfix
Jul 8, 2024
d1e8031
example-based: make tests pass
Jul 8, 2024
84fdb68
prototypes: support non-identity projections
Jul 8, 2024
a7a9cc4
example-based: hotfix
Jul 9, 2024
30e6a56
prototypes: enhance tests and adapt code
Jul 9, 2024
e073178
tf dataset operations: make them on cpu
Jul 10, 2024
1e1b0c7
test prototypes: remove absurd tests
Jul 10, 2024
edabcda
example based: linting
Jul 10, 2024
5904a77
prototypes: change constant for memory
Jul 10, 2024
dee4793
test contrastive: add projection test
Jul 11, 2024
2284905
contrastive: solve projection problems
Jul 11, 2024
0356279
semi-factual: allow to return nuns labels
Jul 11, 2024
ac812ae
prototypes: linting
Jul 11, 2024
f8a377d
example based: clarify distances
Jul 11, 2024
be1ce6d
example based: clarify distances
Jul 11, 2024
ae69b78
example based: clarify distances
Jul 11, 2024
90cb2cf
example base projection: support pytorch
Jul 16, 2024
5f88f74
projections: add initialization from splitted model and target free o…
Jul 17, 2024
25d5331
add the documentation for the prototypes search methods fix up
ChafikBak Jul 18, 2024
c889d48
example-based search methods: add infitity norm distance
Jul 19, 2024
b6c3ffb
example-based projections: debug and remove get inputs weights
Jul 19, 2024
10438b0
example-based: remove weights from possible returns
Jul 19, 2024
2607b56
Merge branch 'antonin/example-based-merge' of https://github.com/deel…
Jul 19, 2024
797f76e
example-based projections: put target free operator as common
Jul 22, 2024
d265330
example-based: split counterfactuals and semifactuals
Jul 22, 2024
56baf6b
add the documentation for the prototypes search methods fix up
ChafikBak Jul 24, 2024
fdee972
add the documentation for the prototypes search methods fix up
ChafikBak Jul 25, 2024
96fbf96
docs: create the api page for example based methods, search methods a…
lucashervier Jul 26, 2024
6e99393
docs: create the KLEOR page
lucashervier Jul 26, 2024
026634e
docs: add pages for naive and label aware cf, for kleor search method…
lucashervier Jul 26, 2024
393914e
docs: add the page for similar examples
lucashervier Jul 30, 2024
37312da
docs: create the documentation page for Cole
lucashervier Jul 30, 2024
6d1247c
fixup: wrong github link
lucashervier Jul 30, 2024
27af808
fixup: in cole documentation, change misleading information
lucashervier Jul 30, 2024
6d15e53
docs: add a documentation page for projections
lucashervier Aug 1, 2024
64903ab
docs: add some details in the api documentation
lucashervier Aug 1, 2024
5b6f026
docs: update the mkdocs.yml
lucashervier Aug 2, 2024
70106fe
example based docs: small modifications
Aug 2, 2024
467c79b
example based: small fixes
Aug 2, 2024
3e638a8
docs: improve documentation with antonin's feedbacks, modify a parame…
lucashervier Aug 5, 2024
410ed98
docs: change the wording of the prototypes such that the search metho…
lucashervier Aug 12, 2024
fbef589
docs: update the main example-based doc page considering antonin's co…
lucashervier Aug 12, 2024
4c2dbc0
projections tests: adapt to commons evolution
Aug 13, 2024
e7f9d4a
pojections tests: add simple splitteing test
Aug 13, 2024
85fc97d
fix: correction on the labelawarecf method for computation of the mas…
lucashervier Aug 14, 2024
1941eea
Merge branch 'antonin/example-based-merge' of github.com:deel-ai/xpli…
lucashervier Aug 14, 2024
1bb8a16
projections: add warning to tensorflow splitting
Aug 14, 2024
ac74a9d
commons: linting
Aug 14, 2024
84a3e65
Merge branch 'antonin/example-based-merge' of https://github.com/deel…
Aug 14, 2024
d709f06
requirements: limit to tensorflow < 2.16
Aug 14, 2024
cedf744
linting
Aug 14, 2024
0316d55
docs: update the README, add warning concerning the tensorflow versio…
lucashervier Aug 14, 2024
02b248a
linting
Aug 19, 2024
41b7476
Merge branch 'antonin/example-based-merge' of https://github.com/deel…
Aug 19, 2024
53b4ba4
projections: add missing targets warning
AntoninPoche Aug 23, 2024
3de2150
docs: update prototypes
ChafikBak Sep 9, 2024
19d8340
docs: update prototypes
ChafikBak Sep 12, 2024
67890c0
pylint: remove E1101 no-member warning
AntoninPoche Sep 18, 2024
5922f0b
counterfactuals: solve label aware explain signature
AntoninPoche Sep 18, 2024
1edde24
datasets operations: move them to example based
AntoninPoche Sep 18, 2024
38fcd81
example based: factorize inputs harmonization
AntoninPoche Sep 18, 2024
0274191
example based: add support for torch dataloader
AntoninPoche Sep 18, 2024
468cbfd
example based: add support for torch dataloader fixup
AntoninPoche Sep 18, 2024
be5bb74
projections: add warning
AntoninPoche Sep 18, 2024
587647c
datasets operations: move them to example based fixup
AntoninPoche Sep 18, 2024
51d040d
Merge branch 'antonin/example-based-merge' of https://github.com/deel…
AntoninPoche Sep 18, 2024
0f92127
docs: update prototypes
ChafikBak Sep 19, 2024
35e1962
Merge branch 'antonin/example-based-merge' of github.com:deel-ai/xpli…
ChafikBak Sep 19, 2024
0e0ab2e
projections: correct from splitted model
AntoninPoche Sep 24, 2024
9662bca
projections: correct target free operator
AntoninPoche Sep 24, 2024
4ddb859
projections: small fix to base
AntoninPoche Sep 24, 2024
8d9975d
commons: sanitize inputs targets disable pylint warning
AntoninPoche Sep 24, 2024
4f94e6b
tests projections: add tests for from splitted model and target free …
AntoninPoche Sep 24, 2024
f515f14
plots: small fix
AntoninPoche Sep 24, 2024
f8bc136
base example methods: projection can now be none
AntoninPoche Sep 24, 2024
f8bb9f8
example based: small pylint fixes
AntoninPoche Sep 24, 2024
cb8eee9
search methods: small pylint fixes
AntoninPoche Sep 24, 2024
f436713
prototypes: optimize and harmonize
AntoninPoche Sep 24, 2024
145f0d5
tests prototypes: adapt to prototypes changes and complete
AntoninPoche Sep 24, 2024
222527a
Merge branch 'antonin/example-based-merge' of https://github.com/deel…
AntoninPoche Sep 24, 2024
c8a0abe
prototypes: small fix
AntoninPoche Sep 25, 2024
97fd2cf
ci: restrict numpy version and specify torch test
AntoninPoche Sep 25, 2024
a4414dd
test example based: small fix
AntoninPoche Sep 25, 2024
4debfd6
rise: fix pylint
AntoninPoche Sep 30, 2024
ef7db46
all: resolve part of example based pr comments
AntoninPoche Oct 3, 2024
b684ad3
example based: small fix
AntoninPoche Oct 3, 2024
a876d7e
example based: small fix
AntoninPoche Oct 3, 2024
3bbf406
example based: small fix
AntoninPoche Oct 4, 2024
f316e9f
example based docs: add prototypes tuto link
AntoninPoche Oct 7, 2024
9c7e3ee
example based: fix pylint issues
AntoninPoche Oct 7, 2024
eaa9d49
setup: ignore pylint too-many-positionnal-arguments because of retroc…
AntoninPoche Oct 7, 2024
aac96c2
example based: small fixes
AntoninPoche Oct 7, 2024
3f4b406
example based tests: small fix
AntoninPoche Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
example based: adapt tests
  • Loading branch information
Antonin POCHE committed Feb 28, 2024
commit 7a58c9fd2b7453dd1b6a245d69167b5c3930bfab
4 changes: 0 additions & 4 deletions tests/example_based/test_cole.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_cole_attribution():
method_constructor = Cole(
cases_dataset=x_train,
targets_dataset=y_train,
search_method=KNN,
k=k,
batch_size=7,
distance="euclidean",
Expand All @@ -89,7 +88,6 @@ def test_cole_attribution():
method_call = SimilarExamples(
cases_dataset=x_train,
targets_dataset=y_train,
search_method=KNN,
k=k,
distance=euclidean_dist,
projection=projection,
Expand All @@ -98,7 +96,6 @@ def test_cole_attribution():
method_different_distance = Cole(
cases_dataset=x_train,
targets_dataset=y_train,
search_method=KNN,
k=k,
batch_size=2,
distance=np.inf, # infinity norm based distance
Expand Down Expand Up @@ -157,7 +154,6 @@ def test_cole_spliting():
method = Cole(
cases_dataset=x_train,
targets_dataset=y_train,
search_method=KNN,
k=k,
case_returns=["examples", "weights", "include_inputs"],
model=model,
Expand Down
3 changes: 1 addition & 2 deletions tests/example_based/test_image_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from xplique.attributions import Occlusion, Saliency

from xplique.example_based import Cole, SimilarExamples
from xplique.example_based.projections import CustomProjection
from xplique.example_based.projections import Projection
from xplique.example_based.search_methods import KNN
from xplique.plots.image import plot_examples

Expand Down Expand Up @@ -70,7 +70,6 @@ def test_plot_cole_spliting():
cases_dataset=x_train,
labels_dataset=tf.argmax(y_train, axis=1),
targets_dataset=y_train,
search_method=KNN,
k=k,
case_returns="all",
model=model,
Expand Down
3 changes: 0 additions & 3 deletions tests/example_based/test_similar_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def test_similar_examples_basic():
method = SimilarExamples(
cases_dataset=x_train,
projection=identity_projection,
search_method=KNN,
k=k,
batch_size=3,
distance="euclidean",
Expand Down Expand Up @@ -194,7 +193,6 @@ def test_similar_examples_return_multiple_elements():
cases_dataset=x_train,
labels_dataset=y_train,
projection=identity_projection,
search_method=KNN,
k=1,
batch_size=3,
distance="euclidean",
Expand Down Expand Up @@ -274,7 +272,6 @@ def test_similar_examples_weighting():
cases_dataset=x_train,
labels_dataset=y_train,
projection=weighting_function,
search_method=KNN,
k=k,
batch_size=5,
distance="euclidean",
Expand Down
2 changes: 1 addition & 1 deletion tests/example_based/test_split_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_attribution_latent_layer():
last_conv_layer = model.get_layer("conv2d_2")
flatten_layer = model.get_layer("flatten")

# default should not include model spliting
# default should not include model splitting
projection_default = AttributionProjection(model)
assert projection_default.latent_layer is None

Expand Down