TextAttack icon indicating copy to clipboard operation
TextAttack copied to clipboard

hard label classification

Open cogeid opened this issue 3 years ago • 1 comments

What does this PR do?

the previous pull request was accidentally closed and could not be reopened due to the original repo being deleted, so I created a new one with the same chagnes

This PR adds a new Goal Function, called "HardLabelClassification", which finds the maximum semantic similarity between two pieces of text such that the generated text is outside of the target model's decision boundary.

Summary

This PR adds the Hard Label Classification goal function, which finds the maximum semantic similarity between two pieces of text such that the generated text is outside of the target model's decision boundary. Below is an example use case, where the user would be able to specify "goal-function hard-label-classification". The implementation for the goal function is based on the paper as well as the corresponding implementation, but only the goal function is being implemented as part of TextAttack.

hardlabeluse

Additions

  • Added a new Goal Function file in the classification folder called "hardlabel_classification.py"
  • Specified the new objective function for the Goal Function in the file

Changes

  • The "hardlabel-classification" attack argument was created for hard label attacks.

Deletions

  • There were no deletions made for this PR.

Checklist

  • [x] The title of your pull request should be a summary of its contribution.
  • [x] Please write detailed description of what parts have been newly added and what parts have been modified. Please also explain why certain changes were made.
  • [x] If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people consulting the issue know you are working on it)
  • [x] To indicate a work in progress please mark it as a draft on Github.
  • [ ] Make sure existing tests pass.
  • [ ] Add relevant tests. No quality testing = no merge.
  • [ ] All public methods must have informative docstrings that work nicely with sphinx. For new modules/files, please add/modify the appropriate .rst file in TextAttack/docs/apidoc.'

cogeid avatar Apr 13 '22 18:04 cogeid

@cogeid - everything should work once you format the code, fix the typo, and push again! Please let me know if you're interested in finishing this

jxmorris12 avatar Jun 29 '22 19:06 jxmorris12