Catalog PyPI
PACKAGE EXPLORERView in registry

adv-ml

PyPI

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

jupyternbdevnotebookpython
Versions collected1
Direct dependencies4From release 0.0.4
Last observed20 Oct, 20:05 UTC

README

Version 0.0.4 documentation

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)
epochtrain_lossvalid_lossaccuracytime
00.1544100.1774100.95390000:32
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, epoch_size=20)
perturbed_dsets = attack.perturb(sub_dsets)
epochtrain_losstime
0-4.30257300:00
1-7.58570700:00
2-9.01496800:00
3-9.70054800:00
4-10.07511000:00
5-10.29663600:00
6-10.43383400:00
7-10.52114100:00
8-10.57767300:00
9-10.61474000:00
learn.show_results(shuffle=False, dl=TfmdDL(perturbed_dsets))

Data Poisoning

patch = torch.tensor([[1, 0, 1],
                      [0, 1, 0],
                      [1, 0, 1]]).int()*255
trigger = F.pad(patch, (25, 0, 25, 0)).numpy()
learn = Learner(mnist.dls(), MLP(10), metrics=accuracy, cbs=BadNetsAttack(trigger, '0'))
learn.fit_one_cycle(1)
epochtrain_lossvalid_lossaccuracytime
00.1036520.0970750.97140000:23

Benign performance:

learn.show_results()

Attack success:

learn.show_results(2)

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.410 Jun 20234

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
irad-zehavi/adv-ml

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:05 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d70b10a8aec01a2d13500a2890f6c79db3abbc71cb4ca5e8241474f8a7a4fc17