From 008005eecf570a02c24a565a012afb50dea60535 Mon Sep 17 00:00:00 2001 From: Kosti Date: Sun, 2 Apr 2023 13:30:55 +0100 Subject: [PATCH] Update README.md --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1f01dc6..de4eb28 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ # setfit-integrated-gradients -Hacking SetFit so that it works with [integrated gradients](https://www.tensorflow.org/tutorials/interpretability/integrated_gradients). See demo.ipynb for an example. +Hacking SetFit so that it works with [integrated gradients](https://www.tensorflow.org/tutorials/interpretability/integrated_gradients). See **demo.ipynb** for an example. -I wrote this mini-library before SetFit 0.6.0. At the time, there was no SetFitHead class yet, so I just took the sklearn LogisticRegression and passed its parameters to an equivalent Torch class. I did my best to break the forward pass of SetFit into pieces so that I can push gradients through the head and up to the token embeddings. - -Attributions from integrated gradients are computed per token and then averaged to get word-level attributions. - -I'm leaving this here for posterity and in case it is useful to others for further hacking. +Integrated gradients is a way to explain the decisions of the model by scoring what parts of the input influenced a particular decision. ## Installation ``` pip install -e . ``` + +The "-e" switch installs the package in develop mode. + +## Notes + +I wrote this mini-library before SetFit 0.6.0. At the time, there was no SetFitHead class yet, so I just took the sklearn LogisticRegression and passed its parameters to an equivalent Torch class. I did my best to break the forward pass of SetFit into pieces so that I can push gradients through the head and up to the token embeddings. + +Attributions from integrated gradients are computed per token and then averaged to get word-level attributions. + +I'm leaving this here for posterity and in case it is useful to others for further hacking.