|
345 | 345 | "pos_df = pd.DataFrame(train_features[ bool_train_labels], columns=train_df.columns)\n",
|
346 | 346 | "neg_df = pd.DataFrame(train_features[~bool_train_labels], columns=train_df.columns)\n",
|
347 | 347 | "\n",
|
348 |
| - "sns.jointplot(pos_df['V5'], pos_df['V6'],\n", |
| 348 | + "sns.jointplot(x=pos_df['V5'], y=pos_df['V6'],\n", |
349 | 349 | " kind='hex', xlim=(-5,5), ylim=(-5,5))\n",
|
350 | 350 | "plt.suptitle(\"Positive distribution\")\n",
|
351 | 351 | "\n",
|
352 |
| - "sns.jointplot(neg_df['V5'], neg_df['V6'],\n", |
| 352 | + "sns.jointplot(x=neg_df['V5'], y=neg_df['V6'],\n", |
353 | 353 | " kind='hex', xlim=(-5,5), ylim=(-5,5))\n",
|
354 | 354 | "_ = plt.suptitle(\"Negative distribution\")"
|
355 | 355 | ]
|
|
814 | 814 | " else:\n",
|
815 | 815 | " plt.ylim([0,1])\n",
|
816 | 816 | "\n",
|
817 |
| - " plt.legend()" |
| 817 | + " plt.legend();" |
818 | 818 | ]
|
819 | 819 | },
|
820 | 820 | {
|
|
960 | 960 | "source": [
|
961 | 961 | "plot_roc(\"Train Baseline\", train_labels, train_predictions_baseline, color=colors[0])\n",
|
962 | 962 | "plot_roc(\"Test Baseline\", test_labels, test_predictions_baseline, color=colors[0], linestyle='--')\n",
|
963 |
| - "plt.legend(loc='lower right')" |
| 963 | + "plt.legend(loc='lower right');" |
964 | 964 | ]
|
965 | 965 | },
|
966 | 966 | {
|
|
1003 | 1003 | "source": [
|
1004 | 1004 | "plot_prc(\"Train Baseline\", train_labels, train_predictions_baseline, color=colors[0])\r\n",
|
1005 | 1005 | "plot_prc(\"Test Baseline\", test_labels, test_predictions_baseline, color=colors[0], linestyle='--')\r\n",
|
1006 |
| - "plt.legend(loc='lower right')" |
| 1006 | + "plt.legend(loc='lower right');" |
1007 | 1007 | ]
|
1008 | 1008 | },
|
1009 | 1009 | {
|
|
1180 | 1180 | "plot_roc(\"Test Weighted\", test_labels, test_predictions_weighted, color=colors[1], linestyle='--')\n",
|
1181 | 1181 | "\n",
|
1182 | 1182 | "\n",
|
1183 |
| - "plt.legend(loc='lower right')" |
| 1183 | + "plt.legend(loc='lower right');" |
1184 | 1184 | ]
|
1185 | 1185 | },
|
1186 | 1186 | {
|
|
1207 | 1207 | "plot_prc(\"Test Weighted\", test_labels, test_predictions_weighted, color=colors[1], linestyle='--')\r\n",
|
1208 | 1208 | "\r\n",
|
1209 | 1209 | "\r\n",
|
1210 |
| - "plt.legend(loc='lower right')" |
| 1210 | + "plt.legend(loc='lower right');" |
1211 | 1211 | ]
|
1212 | 1212 | },
|
1213 | 1213 | {
|
|
1359 | 1359 | "id": "sLEfjZO0-vbN"
|
1360 | 1360 | },
|
1361 | 1361 | "source": [
|
1362 |
| - "Merge the two together using `experimental.sample_from_datasets`:" |
| 1362 | + "Merge the two together using `tf.data.Dataset.sample_from_datasets`:" |
1363 | 1363 | ]
|
1364 | 1364 | },
|
1365 | 1365 | {
|
|
1370 | 1370 | },
|
1371 | 1371 | "outputs": [],
|
1372 | 1372 | "source": [
|
1373 |
| - "resampled_ds = tf.data.experimental.sample_from_datasets([pos_ds, neg_ds], weights=[0.5, 0.5])\n", |
| 1373 | + "resampled_ds = tf.data.Dataset.sample_from_datasets([pos_ds, neg_ds], weights=[0.5, 0.5])\n", |
1374 | 1374 | "resampled_ds = resampled_ds.batch(BATCH_SIZE).prefetch(2)"
|
1375 | 1375 | ]
|
1376 | 1376 | },
|
|
1610 | 1610 | "\n",
|
1611 | 1611 | "plot_roc(\"Train Resampled\", train_labels, train_predictions_resampled, color=colors[2])\n",
|
1612 | 1612 | "plot_roc(\"Test Resampled\", test_labels, test_predictions_resampled, color=colors[2], linestyle='--')\n",
|
1613 |
| - "plt.legend(loc='lower right')" |
| 1613 | + "plt.legend(loc='lower right');" |
1614 | 1614 | ]
|
1615 | 1615 | },
|
1616 | 1616 | {
|
|
1638 | 1638 | "\r\n",
|
1639 | 1639 | "plot_prc(\"Train Resampled\", train_labels, train_predictions_resampled, color=colors[2])\r\n",
|
1640 | 1640 | "plot_prc(\"Test Resampled\", test_labels, test_predictions_resampled, color=colors[2], linestyle='--')\r\n",
|
1641 |
| - "plt.legend(loc='lower right')" |
| 1641 | + "plt.legend(loc='lower right');" |
1642 | 1642 | ]
|
1643 | 1643 | },
|
1644 | 1644 | {
|
|
0 commit comments