update example
This commit is contained in:
parent
c91b2cdbb7
commit
faf8a846d3
@ -104,7 +104,9 @@
|
||||
"source": [
|
||||
"# Get the number of elements in the training and validation dataset\n",
|
||||
"train_size = tf.data.experimental.cardinality(train_dataset).numpy()\n",
|
||||
"valid_size = tf.data.experimental.cardinality(valid_dataset).numpy()"
|
||||
"valid_size = tf.data.experimental.cardinality(valid_dataset).numpy()\n",
|
||||
"print(\"Training dataset size:\", train_size)\n",
|
||||
"print(\"Validation dataset size:\", valid_size)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -139,24 +141,10 @@
|
||||
"valid_dataset = valid_dataset.map(preprocess)\n",
|
||||
"\n",
|
||||
"# Batch and shuffle the datasets\n",
|
||||
"train_dataset = train_dataset.shuffle(2000).batch(80)\n",
|
||||
"train_dataset = train_dataset.shuffle(1000).batch(80)\n",
|
||||
"valid_dataset = valid_dataset.batch(20)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9399bc99",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Get the number of elements in the trainingand validation dataset\n",
|
||||
"train_size = tf.data.experimental.cardinality(train_dataset).numpy()\n",
|
||||
"valid_size = tf.data.experimental.cardinality(valid_dataset).numpy()\n",
|
||||
"print(\"Training dataset size:\", train_size)\n",
|
||||
"print(\"Validation dataset size:\", valid_size)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -171,13 +159,21 @@
|
||||
" \n",
|
||||
"print(x_val.shape, y_val.shape)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "67e152ff-0713-4629-8471-1afbb1bf22a6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"display_name": "Python [conda env:ML]",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "conda-env-ML-py"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
@ -189,7 +185,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.16"
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
Loading…
Reference in New Issue
Block a user