Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions site/en/tutorials/structured_data/imbalanced_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@
"pos_df = pd.DataFrame(train_features[ bool_train_labels], columns=train_df.columns)\n",
"neg_df = pd.DataFrame(train_features[~bool_train_labels], columns=train_df.columns)\n",
"\n",
"sns.jointplot(pos_df['V5'], pos_df['V6'],\n",
"sns.jointplot(x=pos_df['V5'], y=pos_df['V6'],\n",
" kind='hex', xlim=(-5,5), ylim=(-5,5))\n",
"plt.suptitle(\"Positive distribution\")\n",
"\n",
"sns.jointplot(neg_df['V5'], neg_df['V6'],\n",
"sns.jointplot(x=neg_df['V5'], y=neg_df['V6'],\n",
" kind='hex', xlim=(-5,5), ylim=(-5,5))\n",
"_ = plt.suptitle(\"Negative distribution\")"
]
Expand Down Expand Up @@ -814,7 +814,7 @@
" else:\n",
" plt.ylim([0,1])\n",
"\n",
" plt.legend()"
" plt.legend();"
]
},
{
Expand Down Expand Up @@ -960,7 +960,7 @@
"source": [
"plot_roc(\"Train Baseline\", train_labels, train_predictions_baseline, color=colors[0])\n",
"plot_roc(\"Test Baseline\", test_labels, test_predictions_baseline, color=colors[0], linestyle='--')\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand Down Expand Up @@ -1003,7 +1003,7 @@
"source": [
"plot_prc(\"Train Baseline\", train_labels, train_predictions_baseline, color=colors[0])\r\n",
"plot_prc(\"Test Baseline\", test_labels, test_predictions_baseline, color=colors[0], linestyle='--')\r\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand Down Expand Up @@ -1180,7 +1180,7 @@
"plot_roc(\"Test Weighted\", test_labels, test_predictions_weighted, color=colors[1], linestyle='--')\n",
"\n",
"\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand All @@ -1207,7 +1207,7 @@
"plot_prc(\"Test Weighted\", test_labels, test_predictions_weighted, color=colors[1], linestyle='--')\r\n",
"\r\n",
"\r\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand Down Expand Up @@ -1359,7 +1359,7 @@
"id": "sLEfjZO0-vbN"
},
"source": [
"Merge the two together using `experimental.sample_from_datasets`:"
"Merge the two together using `tf.data.Dataset.sample_from_datasets`:"
]
},
{
Expand All @@ -1370,7 +1370,7 @@
},
"outputs": [],
"source": [
"resampled_ds = tf.data.experimental.sample_from_datasets([pos_ds, neg_ds], weights=[0.5, 0.5])\n",
"resampled_ds = tf.data.Dataset.sample_from_datasets([pos_ds, neg_ds], weights=[0.5, 0.5])\n",
"resampled_ds = resampled_ds.batch(BATCH_SIZE).prefetch(2)"
]
},
Expand Down Expand Up @@ -1610,7 +1610,7 @@
"\n",
"plot_roc(\"Train Resampled\", train_labels, train_predictions_resampled, color=colors[2])\n",
"plot_roc(\"Test Resampled\", test_labels, test_predictions_resampled, color=colors[2], linestyle='--')\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand Down Expand Up @@ -1638,7 +1638,7 @@
"\r\n",
"plot_prc(\"Train Resampled\", train_labels, train_predictions_resampled, color=colors[2])\r\n",
"plot_prc(\"Test Resampled\", test_labels, test_predictions_resampled, color=colors[2], linestyle='--')\r\n",
"plt.legend(loc='lower right')"
"plt.legend(loc='lower right');"
]
},
{
Expand Down