Skip to main content

A modular and easy-to-use framework of adversarial machine learning algorithms: https://en.m.wikipedia.org/wiki/Adversarial_machine_learning

Project description

adv-ml

Docs

See https://irad-zehavi.github.io/adv-ml/

Install

pip install adv_ml

How to use

How to Use

As an nbdev library, adv-ml supports import * (without importing unwanted symbols):

from adv_ml.all import *

Adversarial Examples

mnist = MNIST()
classifier = MLP(10)
learn = Learner(mnist.dls(), classifier, metrics=accuracy)
learn.fit(1)
epoch train_loss valid_loss accuracy time
0 0.160490 0.165644 0.954900 00:17
sub_dsets = mnist.valid.random_sub_dsets(64)
learn.show_results(shuffle=False, dl=sub_dsets.dl())

attack = InputOptimizer(classifier, LinfPGD(epsilon=.15), n_epochs=10)
perturbed_dsets = attack.perturb(sub_dsets)
epoch train_loss time
0 -3.627444 00:00
1 -6.452563 00:00
2 -7.652328 00:00
3 -8.258670 00:00
4 -8.617092 00:00
5 -8.851709 00:00
6 -9.014016 00:00
7 -9.130360 00:00
8 -9.216579 00:00
9 -9.281565 00:00
learn.show_results(shuffle=False, dl=TfmdDL(perturbed_dsets))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adv-ml-0.0.2.tar.gz (19.9 kB view hashes)

Uploaded Source

Built Distribution

adv_ml-0.0.2-py3-none-any.whl (18.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page