Skip to content

Commit

Permalink
docs: train only for 4 epochs to speed up execution
Browse files Browse the repository at this point in the history
The result is not great with 32 epochs, either.
  • Loading branch information
lars-reimann committed Nov 26, 2024
1 parent fbf3973 commit 1dfa9f1
Showing 1 changed file with 102 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {
"collapsed": true
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:45.603033Z",
"start_time": "2024-11-26T15:45:45.458288Z"
}
},
"source": [
"from safeds.data.image.containers import ImageList\n",
"\n",
"images, filepaths = ImageList.from_files(\"data/shapes\", return_filenames=True)"
],
"outputs": []
"outputs": [],
"execution_count": 41
},
{
"cell_type": "markdown",
Expand All @@ -81,11 +85,15 @@
")"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:45.611268Z",
"start_time": "2024-11-26T15:45:45.607362Z"
}
},
"id": "66dcf95a3fa51f23",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 42
},
{
"cell_type": "markdown",
Expand All @@ -105,11 +113,15 @@
"dataset = ImageDataset[Column](images, labels, shuffle=True)"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:45.623054Z",
"start_time": "2024-11-26T15:45:45.617103Z"
}
},
"id": "32056ddf5396e070",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 43
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -146,11 +158,15 @@
"]"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:45.655060Z",
"start_time": "2024-11-26T15:45:45.650789Z"
}
},
"id": "806a8091249d533a",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 44
},
{
"cell_type": "markdown",
Expand All @@ -172,11 +188,15 @@
")"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:45.677800Z",
"start_time": "2024-11-26T15:45:45.673254Z"
}
},
"id": "af68cc0d32655d32",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 45
},
{
"cell_type": "markdown",
Expand All @@ -198,15 +218,17 @@
},
{
"cell_type": "code",
"source": [
"cnn_fitted = cnn.fit(dataset, epoch_size=32, batch_size=16)"
],
"source": "cnn_fitted = cnn.fit(dataset, epoch_size=4, batch_size=16)",
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:47.968603Z",
"start_time": "2024-11-26T15:45:45.698565Z"
}
},
"id": "381627a94d500675",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 46
},
{
"cell_type": "markdown",
Expand All @@ -224,11 +246,15 @@
"prediction = cnn_fitted.predict(dataset.get_input())"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:48.153080Z",
"start_time": "2024-11-26T15:45:47.977476Z"
}
},
"id": "62f63dd68362c8b7",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 47
},
{
"cell_type": "markdown",
Expand All @@ -246,11 +272,15 @@
"shuffled_prediction = prediction.shuffle()"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:48.164044Z",
"start_time": "2024-11-26T15:45:48.159184Z"
}
},
"id": "779277d73e30554d",
"execution_count": null,
"outputs": []
"outputs": [],
"execution_count": 48
},
{
"cell_type": "markdown",
Expand All @@ -268,11 +298,27 @@
"shuffled_prediction.get_input().remove_image_by_index(list(range(9, len(prediction))))"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:48.191309Z",
"start_time": "2024-11-26T15:45:48.180506Z"
}
},
"id": "a5ddbbfba41aa7f",
"execution_count": null,
"outputs": []
"outputs": [
{
"data": {
"text/plain": [
"<safeds.data.image.containers._single_size_image_list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6vVMm/evDFpSlxx5a6XNgWKQqFgypQp/Pvf/w5ap7Hkzje2XyE8PJwHHniAkpISr2988gWdTjcmmwvGkrvO4BKJhB/+8IckJyezdOlS/va3v2E0GrHZbH7vKr4bh4V3dSBQVVUV5eXlGAwGkpKSmDp1KjNnziQpKWnU9t3hcKDX69mxY8eQvuVOBwLd1SsDGRkZzJw5kxs3bvDpp59y+fJlPvzwQxwOh3trSFxcHBMnTkQikRAWFoZUKsXpdHL69GmkUqlHN+md4q6u4V+lv78fk8lEU1MTFy5coKmpidraWtrb2xkcHKSjo8O9WJCQkMCLL77It7/97aDljgXj0bPjfDP4D+jH1NX9WwzDAAAAAElFTkSuQmCC"
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 49
},
{
"cell_type": "markdown",
Expand All @@ -290,11 +336,34 @@
"shuffled_prediction.get_output().to_list()[0:9]"
],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-11-26T15:45:48.204453Z",
"start_time": "2024-11-26T15:45:48.199228Z"
}
},
"id": "7081595d7100fb42",
"execution_count": null,
"outputs": []
"outputs": [
{
"data": {
"text/plain": [
"['circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles',\n",
" 'circles']"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 50
}
],
"metadata": {
Expand Down

0 comments on commit 1dfa9f1

Please sign in to comment.