Skip to content

Commit 5b1a9a8

Browse files
authored
Merge pull request #12 from pralab/fix_docs
update changelog and tutorials
2 parents badda6e + 91c08a4 commit 5b1a9a8

16 files changed

Lines changed: 197 additions & 715 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v0.15.1 (16/09/2021)
2+
- #11 Fixed install instructions in tutorial notebooks
3+
- #8 Fixed bug with foolbox CW Attack
4+
5+
## v0.15 (26/11/2021)
6+
- Migration to www.github.com
7+
18
## v0.14.1 (22/04/2021)
29
- This version brings fixes for a few issues with the optimizers and related classes, along with improvements to documentation for all attacks, optimizers, and related classes.
310

tutorials/01-Training.ipynb

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"collapsed": true,
7-
"pycharm": {
8-
"name": "#%% md\n"
9-
}
6+
"collapsed": true
107
},
118
"source": [
129
"# Training of Classifiers and Visualization of Results"
1310
]
1411
},
1512
{
1613
"cell_type": "markdown",
17-
"metadata": {
18-
"pycharm": {
19-
"name": "#%% md\n"
20-
}
21-
},
14+
"metadata": {},
2215
"source": [
2316
"In this first tutorial we aim to show some basic functionality of SecML.\n",
2417
"\n",
@@ -29,11 +22,7 @@
2922
{
3023
"cell_type": "code",
3124
"execution_count": 1,
32-
"metadata": {
33-
"pycharm": {
34-
"name": "#%%\n"
35-
}
36-
},
25+
"metadata": {},
3726
"outputs": [],
3827
"source": [
3928
"%%capture --no-stderr --no-display\n",
@@ -42,16 +31,12 @@
4231
"try:\n",
4332
" import secml\n",
4433
"except ImportError:\n",
45-
" %pip install git+https://gitlab.com/secml/secml"
34+
" %pip install git+https://github.com/pralab/secml"
4635
]
4736
},
4837
{
4938
"cell_type": "markdown",
50-
"metadata": {
51-
"pycharm": {
52-
"name": "#%% md\n"
53-
}
54-
},
39+
"metadata": {},
5540
"source": [
5641
"## Creation and visualization of a simple 2D dataset\n",
5742
"\n",
@@ -66,11 +51,7 @@
6651
{
6752
"cell_type": "code",
6853
"execution_count": 2,
69-
"metadata": {
70-
"pycharm": {
71-
"name": "#%%\n"
72-
}
73-
},
54+
"metadata": {},
7455
"outputs": [],
7556
"source": [
7657
"random_state = 999\n",
@@ -99,11 +80,7 @@
9980
{
10081
"cell_type": "code",
10182
"execution_count": 3,
102-
"metadata": {
103-
"pycharm": {
104-
"name": "#%%\n"
105-
}
106-
},
83+
"metadata": {},
10784
"outputs": [],
10885
"source": [
10986
"n_tr = 1000 # Number of training set samples\n",
@@ -124,11 +101,7 @@
124101
},
125102
{
126103
"cell_type": "markdown",
127-
"metadata": {
128-
"pycharm": {
129-
"name": "#%% md\n"
130-
}
131-
},
104+
"metadata": {},
132105
"source": [
133106
"Let's visualize the dataset in a 2D plane.\n",
134107
"\n",
@@ -138,11 +111,7 @@
138111
{
139112
"cell_type": "code",
140113
"execution_count": 4,
141-
"metadata": {
142-
"pycharm": {
143-
"name": "#%%\n"
144-
}
145-
},
114+
"metadata": {},
146115
"outputs": [
147116
{
148117
"data": {
@@ -174,8 +143,7 @@
174143
"cell_type": "markdown",
175144
"metadata": {
176145
"pycharm": {
177-
"is_executing": false,
178-
"name": "#%% md\n"
146+
"is_executing": false
179147
}
180148
},
181149
"source": [
@@ -193,11 +161,7 @@
193161
{
194162
"cell_type": "code",
195163
"execution_count": 5,
196-
"metadata": {
197-
"pycharm": {
198-
"name": "#%%\n"
199-
}
200-
},
164+
"metadata": {},
201165
"outputs": [
202166
{
203167
"name": "stdout",
@@ -253,11 +217,7 @@
253217
},
254218
{
255219
"cell_type": "markdown",
256-
"metadata": {
257-
"pycharm": {
258-
"name": "#%% md\n"
259-
}
260-
},
220+
"metadata": {},
261221
"source": [
262222
"## Visualization of the decision regions of the classifiers\n",
263223
"\n",
@@ -268,11 +228,7 @@
268228
{
269229
"cell_type": "code",
270230
"execution_count": 6,
271-
"metadata": {
272-
"pycharm": {
273-
"name": "#%%\n"
274-
}
275-
},
231+
"metadata": {},
276232
"outputs": [
277233
{
278234
"data": {
@@ -304,11 +260,7 @@
304260
},
305261
{
306262
"cell_type": "markdown",
307-
"metadata": {
308-
"pycharm": {
309-
"name": "#%% md\n"
310-
}
311-
},
263+
"metadata": {},
312264
"source": [
313265
"## Training other classifiers\n",
314266
"\n",
@@ -325,9 +277,6 @@
325277
"cell_type": "code",
326278
"execution_count": 7,
327279
"metadata": {
328-
"pycharm": {
329-
"name": "#%%\n"
330-
},
331280
"scrolled": true
332281
},
333282
"outputs": [
@@ -482,4 +431,4 @@
482431
},
483432
"nbformat": 4,
484433
"nbformat_minor": 1
485-
}
434+
}

tutorials/02-NeuralNetworks.ipynb

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"collapsed": true,
7-
"pycharm": {
8-
"name": "#%% md\n"
9-
}
6+
"collapsed": true
107
},
118
"source": [
129
"# Neural Networks with PyTorch\n",
@@ -31,11 +28,7 @@
3128
{
3229
"cell_type": "code",
3330
"execution_count": 1,
34-
"metadata": {
35-
"pycharm": {
36-
"name": "#%%\n"
37-
}
38-
},
31+
"metadata": {},
3932
"outputs": [],
4033
"source": [
4134
"%%capture --no-stderr --no-display\n",
@@ -45,16 +38,12 @@
4538
" import secml\n",
4639
" import torch\n",
4740
"except ImportError:\n",
48-
" %pip install git+https://gitlab.com/secml/secml#egg=secml[pytorch]"
41+
" %pip install git+https://github.com/pralab/secml#egg=secml[pytorch]"
4942
]
5043
},
5144
{
5245
"cell_type": "markdown",
53-
"metadata": {
54-
"pycharm": {
55-
"name": "#%% md\n"
56-
}
57-
},
46+
"metadata": {},
5847
"source": [
5948
"## Classifying blobs\n",
6049
"\n",
@@ -95,11 +84,7 @@
9584
},
9685
{
9786
"cell_type": "markdown",
98-
"metadata": {
99-
"pycharm": {
100-
"name": "#%% md\n"
101-
}
102-
},
87+
"metadata": {},
10388
"source": [
10489
"We will use a 5D dataset composed with 3 gaussians. We can use 4k samples for \n",
10590
"training and 1k for testing. We can divide the sets in batches so that they can \n",
@@ -149,11 +134,7 @@
149134
},
150135
{
151136
"cell_type": "markdown",
152-
"metadata": {
153-
"pycharm": {
154-
"name": "#%% md\n"
155-
}
156-
},
137+
"metadata": {},
157138
"source": [
158139
"Now we can create an instance of the PyTorch model and then wrap it in the \n",
159140
"specific class that will link it to our library functionalities."
@@ -164,8 +145,7 @@
164145
"execution_count": 4,
165146
"metadata": {
166147
"pycharm": {
167-
"is_executing": false,
168-
"name": "#%%\n"
148+
"is_executing": false
169149
}
170150
},
171151
"outputs": [],
@@ -192,11 +172,7 @@
192172
},
193173
{
194174
"cell_type": "markdown",
195-
"metadata": {
196-
"pycharm": {
197-
"name": "#%% md\n"
198-
}
199-
},
175+
"metadata": {},
200176
"source": [
201177
"We can simply use the loaded `CDataset` and pass it to the `fit` method. The \n",
202178
"wrapper will handle batch processing and train the network for the number of epochs \n",
@@ -208,8 +184,7 @@
208184
"execution_count": 5,
209185
"metadata": {
210186
"pycharm": {
211-
"is_executing": true,
212-
"name": "#%%\n"
187+
"is_executing": true
213188
}
214189
},
215190
"outputs": [
@@ -231,11 +206,7 @@
231206
},
232207
{
233208
"cell_type": "markdown",
234-
"metadata": {
235-
"pycharm": {
236-
"name": "#%% md\n"
237-
}
238-
},
209+
"metadata": {},
239210
"source": [
240211
"Using the model in \"predict\" mode is just as easy. We can use the method `predict` \n",
241212
"defined in our wrapper, and pass in the data. We can evaluate the accuracy with \n",
@@ -247,8 +218,7 @@
247218
"execution_count": 6,
248219
"metadata": {
249220
"pycharm": {
250-
"is_executing": true,
251-
"name": "#%%\n"
221+
"is_executing": true
252222
}
253223
},
254224
"outputs": [
@@ -291,4 +261,4 @@
291261
},
292262
"nbformat": 4,
293263
"nbformat_minor": 1
294-
}
264+
}

0 commit comments

Comments
 (0)