{"id":197628,"date":"2023-10-13T11:25:54","date_gmt":"2023-10-13T15:25:54","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=197628"},"modified":"2023-10-13T15:18:08","modified_gmt":"2023-10-13T19:18:08","slug":"convolutional-neural-networks-part-iii","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/","title":{"rendered":"Convolutional Neural Networks &#8211; Part III"},"content":{"rendered":"\n<p><em>Read <a href=\"\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-i\/\">Part I<\/a>&nbsp;and <a href=\"\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-ii\/\">Part II<\/a> to learn about convolutional neural networks. <\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"steps-to-use-convolutional-neural-networks-in-trading-with-python\">Steps to use convolutional neural networks in trading with Python<\/h2>\n\n\n\n<p>We will now see a simple model with the CNN architecture for the image with the candlestick patterns. The model will be trained for 10 epochs. Here, one Epoch is equivalent to one cycle for training a machine learning model.<\/p>\n\n\n\n<p>The number of epochs keeps increasing until the validation error reduces.<\/p>\n\n\n\n<p>The Conv2D layers define the convolutional layers with ReLU activation, while MaxPooling2D is used for regularisation. Also, the Dense layers are used for classification.<\/p>\n\n\n\n<p>Hence, the final outcome will help you find out the performance of the model.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-1-importing-necessary-libraries\">Step 1: Importing necessary libraries<\/h3>\n\n\n\n<p>We will first of all import TensorFlow and will use tf.keras.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Importing libraries\nimport numpy as np\nimport tensorflow as tf<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/57a1e2d961f96d785332df4f82a4c691#file-import_lib-py\">Import_lib.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-2-generate-random-train-and-test-data-for-demonstration\">Step 2: Generate random train and test data for demonstration<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># We create image data for train and test purposes with the following inputs\nnum_train_samples = 1000\nnum_test_samples = 200\nimage_width = 128\nimage_height = 128\nchannels = 1 # Grayscale image (single channel)\nnum_classes = 2 # Binary classification (two classes)\n\n# Generate random training and test data for demonstration\nX_train = np.random.random((num_train_samples, image_width, image_height, channels))\ny_train = np.random.randint(low=0, high=num_classes, size=num_train_samples)\nX_test = np.random.random((num_test_samples, image_width, image_height, channels))<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/fb045fb9c58f382e3a3368962034b53a#file-random_train_test-py\">Random_train_test.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-3-define-the-cnn-model\">Step 3: Define the CNN model<\/h3>\n\n\n\n<p>Now, we will define the CNN model that will help with prediction in trading.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Define the CNN model\nmodel = tf.keras.models.Sequential([\ntf.keras.layers.Conv2D(32, (3, 3), activation='relu', input_shape=(image_width, image_height, channels)),\ntf.keras.layers.MaxPooling2D((2, 2)),\ntf.keras.layers.Conv2D(64, (3, 3), activation='relu'),\ntf.keras.layers.MaxPooling2D((2, 2)),\ntf.keras.layers.Flatten(),\ntf.keras.layers.Dense(64, activation='relu'),\ntf.keras.layers.Dense(num_classes, activation='softmax')\n])<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/1ae22ef73017db3d9d9b80369175fa89#file-define_cnn-py\">Define_CNN.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>The model is defined using the Sequential API, and the layers are added sequentially. The architecture consists of several Conv2D layers with ReLU activation, followed by MaxPooling2D layers to reduce spatial dimensions. The final layers include a Flatten layer to flatten the output, fully connected Dense layers, and an output layer with softmax activation for classification.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-4-normalise-the-training-and-test-data\">Step 4: Normalise the training and test data<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Normalise the training and test images if necessary\nX_train = X_train \/ 255.0\nX_test = X_test \/ 255.0<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/da36563674a655b109152e74ed638a3c#file-normalise-py\">Normalise.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-5-compile-and-train-the-model\">Step 5: Compile and train the model<\/h3>\n\n\n\n<p>Finally, the model is compiled, trained and made to make predictions on the new images.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Compile and train the model\nmodel.compile(optimizer='adam',\nloss='sparse_categorical_crossentropy',\nmetrics=['accuracy'])\n\nmodel.fit(X_train, y_train, epochs=10, batch_size=32)\n\n# Use the trained model to make predictions on new images\npredictions = model.predict(X_test)\n\nmodel.fit(X_train, y_train, epochs=10, batch_size=32)\n\n\n# Use the trained model to make predictions on new images\npredictions = model.predict(X_test)<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/2192ba6e24ebb416a0f55ee28a31a488#file-compile_train-py\">Compile_train.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>The model is compiled with the Adam optimizer, sparse categorical cross-entropy loss function, and accuracy as the evaluation metric.<\/p>\n\n\n\n<p>Output:<\/p>\n\n\n\n<p>Epoch 1\/10 32\/32 [==============================] &#8211; 8s 223ms\/step &#8211; loss: 2.3030 &#8211; accuracy: 0.0990<\/p>\n\n\n\n<p>Epoch 2\/10 32\/32 [==============================] &#8211; 10s 330ms\/step &#8211; loss: 2.2998 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 3\/10 32\/32 [==============================] &#8211; 5s 172ms\/step &#8211; loss: 2.3015 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 4\/10 32\/32 [==============================] &#8211; 6s 201ms\/step &#8211; loss: 2.2994 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 5\/10 32\/32 [==============================] &#8211; 6s 183ms\/step &#8211; loss: 2.2996 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 6\/10 32\/32 [==============================] &#8211; 5s 170ms\/step &#8211; loss: 2.2981 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 7\/10 32\/32 [==============================] &#8211; 7s 210ms\/step &#8211; loss: 2.2987 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 8\/10 32\/32 [==============================] &#8211; 5s 168ms\/step &#8211; loss: 2.2981 &#8211; accuracy: 0.1200<\/p>\n\n\n\n<p>Epoch 9\/10 32\/32 [==============================] &#8211; 7s 216ms\/step &#8211; loss: 2.2993 &#8211; accuracy: 0.1200 Epoch 10\/10 32\/32 [==============================] &#8211; 5s 167ms\/step &#8211; loss: 2.2975 &#8211; accuracy: 0.1200 7\/7 [==============================] &#8211; 0s 43ms\/step<\/p>\n\n\n\n<p>The above output shows the final loss and accuracy values on the test set.<\/p>\n\n\n\n<p>In this specific output, the model did not achieve a very high accuracy on both the training and test sets. Hence, the output is not indicating a good performance.<\/p>\n\n\n\n<p>Also, the final outcome shows that the loss values are not decreasing over the epochs, indicating that the model is not learning and improving its predictions.<\/p>\n\n\n\n<p>For making the loss values decrease over the epochs and to make the model achieve a high accuracy rate, you need to input the model with more number of epochs and you can change the parameters accordingly.<\/p>\n\n\n\n<p>In the similar manner, you can fetch the image data (candlestick pattern, line chart) for a stock (for example, AAPL, TSLA, GOOGL etc.) and train the model on a certain number of epochs.<\/p>\n\n\n\n<p><strong>Python codes for trading with CNN<\/strong><\/p>\n\n\n\n<p>For trading, you will need the following lines of code below to give you the result. In this case, also the result will be the computation of final loss and accuracy.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Import libraries\nimport numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom keras.models import Sequential\nfrom keras.layers import Conv1D, MaxPooling1D, Flatten, Dense\n\n# Load and preprocess the data\ndata = pd.read_csv('trading_data.csv')\n\n# Perform data preprocessing steps as per your requirements\n# Split the data into training and testing sets\ntrain_data = data.loc[data['date'] &lt; date_to_split]\ntest_data = data.loc[data['date'] &gt;= date_to_split]\n\n# Define the input and output variables\nx_train = train_data[['feature1', 'feature2', 'feature3']].values\ny_train = train_data['target'].values\nx_test = test_data[['feature1', 'feature2', 'feature3']].values\ny_test = test_data['target'].values<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/ad4a3894af817f3de88dc3480b4615ed#file-trading_with_cnn-py\">Trading_with_CNN.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>And, we reach the end of this blog! You can now use the convolutional neural networks on your own for training the CNN model.<\/p>\n\n\n\n<p><em>Originally posted on&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/convolutional-neural-networks\/\">QuantInsti<\/a>&nbsp;Blog.<\/em> <em>Visit their website for additional insights on this topic.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will now see a simple model with the CNN architecture for the image with the candlestick patterns.<\/p>\n","protected":false},"author":368,"featured_media":83281,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341],"tags":[851,15907,1225,595,924],"contributors-categories":[13654],"class_list":{"0":"post-197628","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"tag-algo-trading","13":"tag-convolutional-neural-networks","14":"tag-numpy","15":"tag-python","16":"tag-tensorflow","17":"contributors-categories-quantinsti"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Convolutional Neural Networks &#8211; Part III | IBKR Quant<\/title>\n<meta name=\"description\" content=\"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/197628\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convolutional Neural Networks - Part III | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-13T15:25:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-13T19:18:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chainika Thakar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chainika Thakar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Chainika Thakar\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/c97b4c6a477fa019494f67cff50fcb10\"\n\t            },\n\t            \"headline\": \"Convolutional Neural Networks &#8211; Part III\",\n\t            \"datePublished\": \"2023-10-13T15:25:54+00:00\",\n\t            \"dateModified\": \"2023-10-13T19:18:08+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/\"\n\t            },\n\t            \"wordCount\": 634,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/04\\\/python-tile.jpg\",\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Convolutional Neural Networks\",\n\t                \"NumPy\",\n\t                \"Python\",\n\t                \"TensorFlow\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/\",\n\t            \"name\": \"Convolutional Neural Networks - Part III | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/04\\\/python-tile.jpg\",\n\t            \"datePublished\": \"2023-10-13T15:25:54+00:00\",\n\t            \"dateModified\": \"2023-10-13T19:18:08+00:00\",\n\t            \"description\": \"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/convolutional-neural-networks-part-iii\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/04\\\/python-tile.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/04\\\/python-tile.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Python\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/c97b4c6a477fa019494f67cff50fcb10\",\n\t            \"name\": \"Chainika Thakar\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/chainikathakar\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Convolutional Neural Networks &#8211; Part III | IBKR Quant","description":"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/197628\/","og_locale":"en_US","og_type":"article","og_title":"Convolutional Neural Networks - Part III | IBKR Campus US","og_description":"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/","og_site_name":"IBKR Campus US","article_published_time":"2023-10-13T15:25:54+00:00","article_modified_time":"2023-10-13T19:18:08+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","type":"image\/jpeg"}],"author":"Chainika Thakar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Chainika Thakar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/"},"author":{"name":"Chainika Thakar","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/c97b4c6a477fa019494f67cff50fcb10"},"headline":"Convolutional Neural Networks &#8211; Part III","datePublished":"2023-10-13T15:25:54+00:00","dateModified":"2023-10-13T19:18:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/"},"wordCount":634,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","keywords":["Algo Trading","Convolutional Neural Networks","NumPy","Python","TensorFlow"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/","name":"Convolutional Neural Networks - Part III | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","datePublished":"2023-10-13T15:25:54+00:00","dateModified":"2023-10-13T19:18:08+00:00","description":"We will now see a simple model with the CNN architecture for the image with the candlestick patterns.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/convolutional-neural-networks-part-iii\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","width":1000,"height":563,"caption":"Python"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/c97b4c6a477fa019494f67cff50fcb10","name":"Chainika Thakar","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/chainikathakar\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/04\/python-tile.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/197628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/368"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=197628"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/197628\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/83281"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=197628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=197628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=197628"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=197628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}