Commit 6e2c8d88 authored by Oliver Kirsebom's avatar Oliver Kirsebom
Browse files

part III working

parent f2336e1d
......@@ -1190,12 +1190,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We load the training/validation dataset from the same HDF5 database that contains the test dataset used previously."
"We load the training/validation dataset from the HDF5 table that we created previously."
]
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
......@@ -1207,27 +1207,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We'll split this dataset into training and validation using an stratified sampling algorithm ([scikit-learn's StratifiedShuffleSplit](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.StratifiedShuffleSplit.html)). This yields training and validation datasets with the same proportions of positive (upcall) and negative (no upcall) examples. \n"
"We will split the dataset into a training set of 30 (randomly selected) samples and a validation set consisting of the 10 remaining samples. "
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[26 12 9 23 38 24 18 35 10 14 11 0 19 8 39 32 30 17 1 13 16 28 3 2\n",
" 21 36 4 33 6 34]\n",
"[5, 7, 15, 20, 22, 25, 27, 29, 31, 37]\n"
"[24 2 17 15 39 25 9 22 28 16 30 5 14 1 32 6 3 35 13 8 27 33 19 10\n",
" 34 31 7 26 36 21]\n",
"[0, 4, 11, 12, 18, 20, 23, 29, 37, 38]\n"
]
}
],
"source": [
"train_indices = np.random.choice(np.arange(40), 30, replace=False)\n",
"val_indices = [i for i in range(40) if i not in train_indices]\n",
"train_indices = np.random.choice(np.arange(40), 30, replace=False) # select 30 random indices out of 0...39\n",
"val_indices = [i for i in range(40) if i not in train_indices] # 10 indices that were not selected\n",
"\n",
"print(train_indices)\n",
"print(val_indices)"
......@@ -1262,7 +1262,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we have configured two batch generators, which will load 32 spectrograms and associated labels at a time during the training process. After attaching these generators to the new_resnet_model, we can run the training loop for a couple of epochs."
"Now we have configured two batch generators, which will load 10 spectrograms and associated labels at a time during the training process. After attaching these generators to the new_resnet_model, we can run the training loop for a couple of epochs."
]
},
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment