|
853 | 853 | "output_type": "stream",
|
854 | 854 | "text": [
|
855 | 855 | "Test set size: 114\n",
|
856 |
| - "Succes rate: 100.00%\n" |
| 856 | + "Success rate: 100.00%\n" |
857 | 857 | ]
|
858 | 858 | }
|
859 | 859 | ],
|
|
864 | 864 | " y_valid_cancer.apply(lambda x: np.random.choice([i for i in range(n_classes) if i != x]))\n",
|
865 | 865 | ")]\n",
|
866 | 866 | "\n",
|
867 |
| - "# Generate adverasies\n", |
| 867 | + "# Generate adversaries\n", |
868 | 868 | "adversaries = lpf_svc.generate(x=X_valid_cancer, y=targets)\n",
|
869 | 869 | "\n",
|
870 | 870 | "# Check the success rate\n",
|
|
874 | 874 | "correct = (expected == predicted)\n",
|
875 | 875 | "success_rate = np.sum(correct) / correct.shape[0]\n",
|
876 | 876 | "print(\"Test set size: {}\".format(targets.shape[0]))\n",
|
877 |
| - "print(\"Succes rate: {:.2f}%\".format(100*success_rate))" |
| 877 | + "print(\"Success rate: {:.2f}%\".format(100*success_rate))" |
878 | 878 | ]
|
879 | 879 | },
|
880 | 880 | {
|
|
1092 | 1092 | " correct = (expected == predicted)\n",
|
1093 | 1093 | " \n",
|
1094 | 1094 | " success_rate = np.sum(correct) / correct.shape[0]\n",
|
1095 |
| - " print(\"Succes rate: {:.2f}%\".format(100*success_rate))\n", |
| 1095 | + " print(\"Success rate: {:.2f}%\".format(100*success_rate))\n", |
1096 | 1096 | " \n",
|
1097 | 1097 | " return adversaries"
|
1098 | 1098 | ]
|
|
1113 | 1113 | "name": "stdout",
|
1114 | 1114 | "output_type": "stream",
|
1115 | 1115 | "text": [
|
1116 |
| - "Succes rate: 100.00%\n" |
| 1116 | + "Success rate: 100.00%\n" |
1117 | 1117 | ]
|
1118 | 1118 | }
|
1119 | 1119 | ],
|
1120 | 1120 | "source": [
|
1121 |
| - "# Wrapping classifier into appropiate ART-friendly wrapper\n", |
| 1121 | + "# Wrapping classifier into appropriate ART-friendly wrapper\n", |
1122 | 1122 | "logistic_regression_iris_wrapper = ScikitlearnLogisticRegression(\n",
|
1123 | 1123 | " model = log_regression_clf_iris, \n",
|
1124 | 1124 | " clip_values = scaled_clip_values_iris\n",
|
|
1251 | 1251 | "name": "stdout",
|
1252 | 1252 | "output_type": "stream",
|
1253 | 1253 | "text": [
|
1254 |
| - "Succes rate: 100.00%\n" |
| 1254 | + "Success rate: 100.00%\n" |
1255 | 1255 | ]
|
1256 | 1256 | }
|
1257 | 1257 | ],
|
1258 | 1258 | "source": [
|
1259 |
| - "# Wrapping classifier into appropiate ART-friendly wrapper\n", |
| 1259 | + "# Wrapping classifier into appropriate ART-friendly wrapper\n", |
1260 | 1260 | "logistic_regression_cancer_wrapper = ScikitlearnLogisticRegression(\n",
|
1261 | 1261 | " model = log_regression_clf_cancer, \n",
|
1262 | 1262 | " clip_values = scaled_clip_values_cancer\n",
|
|
1382 | 1382 | " correct = (expected == predicted)\n",
|
1383 | 1383 | " \n",
|
1384 | 1384 | " success_rate = np.sum(correct) / correct.shape[0]\n",
|
1385 |
| - " print(\"Succes rate: {:.2f}%\".format(100*success_rate))\n", |
| 1385 | + " print(\"Success rate: {:.2f}%\".format(100*success_rate))\n", |
1386 | 1386 | " \n",
|
1387 | 1387 | " return adversaries"
|
1388 | 1388 | ]
|
|
1403 | 1403 | "name": "stdout",
|
1404 | 1404 | "output_type": "stream",
|
1405 | 1405 | "text": [
|
1406 |
| - "Succes rate: 100.00%\n" |
| 1406 | + "Success rate: 100.00%\n" |
1407 | 1407 | ]
|
1408 | 1408 | }
|
1409 | 1409 | ],
|
1410 | 1410 | "source": [
|
1411 |
| - "# Wrapping classifier into appropiate ART-friendly wrapper\n", |
| 1411 | + "# Wrapping classifier into appropriate ART-friendly wrapper\n", |
1412 | 1412 | "# (in this case it is PyTorch NN classifier wrapper from ART)\n",
|
1413 | 1413 | "neural_network_iris_wrapper = PyTorchClassifier(\n",
|
1414 | 1414 | " model = nn_model_iris, \n",
|
|
1516 | 1516 | "name": "stdout",
|
1517 | 1517 | "output_type": "stream",
|
1518 | 1518 | "text": [
|
1519 |
| - "Succes rate: 97.37%\n" |
| 1519 | + "Success rate: 97.37%\n" |
1520 | 1520 | ]
|
1521 | 1521 | }
|
1522 | 1522 | ],
|
1523 | 1523 | "source": [
|
1524 |
| - "# Wrapping classifier into appropiate ART-friendly wrapper\n", |
| 1524 | + "# Wrapping classifier into appropriate ART-friendly wrapper\n", |
1525 | 1525 | "# (in this case it is PyTorch NN classifier wrapper from ART)\n",
|
1526 | 1526 | "neural_network_cancer_wrapper = PyTorchClassifier(\n",
|
1527 | 1527 | " model = nn_model_cancer, \n",
|
|
0 commit comments