Giter Club home page Giter Club logo

dddm's Introduction

DDDM: a brain-inspired framework for robust classification

This is the source code of our dropout-bayes-based classifier framework.

Workflow to plot accuracy heatmaps from scratch

  • run traintest.train_model() to train a neural network classifier (NN).
  • run traintest.pipeline() to attack the NN, save the NN predictions, estimate likelihood of NN predictions and perform cumsum & bayesian inference.
  • run analysis.plot_heatmap() to plot the accuracy heatmaps.

Workflow to plot ϵ-Acc/RT from scratch

  • run traintest.train_model() to train a neural network classifier (NN).
  • run traintest.pipeline() to attack the NN, save the NN predictions, estimate likelihood of NN predictions and perform cumsum & bayesian inference.
  • run analysis.plot_epsilon_accrt() to plot the relationship between ϵ and Acc/RT.

Notes to attack NLP model with textattack.attack_recipes.textbugger_li_2018 in China

  • install textattack

    • in my case, I install version==0.3.0 from source codes to avoid some unnecessary dependence
    • further more, in requirements.txt, scipy==1.4.1 is unnecessary and could raise error while during installation, you can replace it with scipy>=1.4.1
    • again, numpy<1.19.0 is unnecessary, numpy==1.21.4 works fine in my case
  • run nlp.attack_model_textattack()

  • In case of a download timeout of universal-sentence-encoder_4, here is a work-around:

    • open /home/yourusername/.local/lib/python3.9/site-packages/textattack/constraints/semantics/sentence_encoders/universal_sentence_encoder/universal_sentence_encoder.py
    • replace tfhub_url = "https://tfhub.dev/google/universal-sentence-encoder/4"
    • with tfhub_url = './data/universal-sentence-encoder_4/'
    • download universal-sentence-encoder_4.tar.gz from https://tfhub.dev/google/universal-sentence-encoder/4
    • extract the downloaded file in ./data/, so there will be a DDDM/data/universal-sentence-encoder_4/saved_model.pb after the extraction
    • now try running nlp.attack_model_textattack()
  • run traintest.pipeline() and analysis.plot_heatmap() to get heatmaps

Attacking Audio Models

  • run attack_model_artasr() after training the models
  • run traintest.pipeline() and analysis.plot_heatmap() to get heatmaps

dddm's People

Contributors

xiyuan68 avatar

Stargazers

 avatar

Watchers

 avatar Xingyu Li avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.