{"id":31047,"date":"2020-01-10T09:42:34","date_gmt":"2020-01-10T14:42:34","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=31047"},"modified":"2022-11-21T09:44:54","modified_gmt":"2022-11-21T14:44:54","slug":"neural-network-in-python-part-vii","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/","title":{"rendered":"Neural Network In Python \u2013 Part VII"},"content":{"rendered":"\n<p><em>In the <a href=\"\/campus\/ibkr-quant-news\/neural-network-in-python-part-vi\/\">previous installment<\/a>, the author discussed how to develop our own Artificial Neural Network.&nbsp; <\/em><\/p>\n\n\n\n<p><strong>Setting the random seed to a fixed number<\/strong><\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\">import random\nrandom.seed(42)<\/p>\n\n\n\n<p>Random will be used to initialize the seed to a fixed number so that every time we run the code we start with the same seed.<\/p>\n\n\n\n<p><strong>Importing the dataset<\/strong><\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\">dataset = pd.read_csv(&#8216;RELIANCE.NS.csv&#8217;)<br>\ndataset = dataset.dropna()<br>\ndataset = dataset[[&#8216;Open&#8217;, &#8216;High&#8217;, &#8216;Low&#8217;, &#8216;Close&#8217;]]<\/p>\n\n\n\n<p>We then import our dataset, which is stored in the .csv file named \u2018RELIANCE.NS.csv\u2019. This is done using the pandas library, and the data is stored in a dataframe named dataset. We then drop the missing values in the dataset using the dropna() function. The csv file contains daily OHLC data for the stock of Reliance trading on NSE for the time period from 1st January 1996 to 15th January 2018.&nbsp;<\/p>\n\n\n\n<p>We choose only the OHLC data from this dataset, which would also contain the date, Adjusted Close and Volume data. We will be building our input features by using only the OHLC values.<\/p>\n\n\n\n<p><em>In the next installment, the author will demonstrate how to prepare the dataset.<\/em><\/p>\n\n\n\n<p>Visit&nbsp;<a href=\"https:\/\/www.quantinsti.com\/\">https:\/\/www.quantinsti.com\/<\/a>&nbsp;for ready-to-use functions as applied in trading and data analysis. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>We import our dataset, which is stored in the .csv file named \u2018RELIANCE.NS.csv\u2019. This is done using the pandas library, and the data is stored in a dataframe named dataset. We then drop the missing values in the dataset using the dropna() function<\/p>\n","protected":false},"author":251,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,350,341,344],"tags":[851,4087,4582,2105,2697,4363,4227,852,3866,1225,1224,595,5902,5482,5483],"contributors-categories":[13654],"class_list":{"0":"post-31047","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-data-science","7":"category-programing-languages","8":"category-python-development","9":"category-ibkr-quant-news","10":"category-quant-asia-pacific","11":"category-quant-development","12":"category-quant-regions","13":"tag-algo-trading","14":"tag-backpropagation","15":"tag-dataframe","16":"tag-deep-learning","17":"tag-deep-neural-networks","18":"tag-forward-propagation","19":"tag-gradient-descent","20":"tag-machine-learning","21":"tag-neuron","22":"tag-numpy","23":"tag-pandas","24":"tag-python","25":"tag-rsi-stochastic-gradient-descent","26":"tag-talib","27":"tag-williams-r","28":"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.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Neural Network In Python \u2013 Part VII | IBKR Quant<\/title>\n<meta name=\"description\" content=\"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset\" \/>\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\/31047\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Neural Network In Python \u2013 Part VII | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-10T14:42:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:44:54+00:00\" \/>\n<meta name=\"author\" content=\"Devang Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Devang Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\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\\\/neural-network-in-python-part-vii\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/neural-network-in-python-part-vii\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Devang Singh\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e3e144de3dc01a5e3d3b01449fb26629\"\n\t            },\n\t            \"headline\": \"Neural Network In Python \u2013 Part VII\",\n\t            \"datePublished\": \"2020-01-10T14:42:34+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:44:54+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/neural-network-in-python-part-vii\\\/\"\n\t            },\n\t            \"wordCount\": 214,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Backpropagation\",\n\t                \"Dataframe\",\n\t                \"Deep Learning\",\n\t                \"Deep Neural Networks\",\n\t                \"Forward propagation\",\n\t                \"Gradient Descent\",\n\t                \"Machine Learning\",\n\t                \"Neuron\",\n\t                \"NumPy\",\n\t                \"Pandas\",\n\t                \"Python\",\n\t                \"rsi Stochastic Gradient Descent\",\n\t                \"Talib\",\n\t                \"Williams %R\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Asia Pacific\",\n\t                \"Quant Development\",\n\t                \"Quant Regions\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/neural-network-in-python-part-vii\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/neural-network-in-python-part-vii\\\/\",\n\t            \"name\": \"Neural Network In Python \u2013 Part VII | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"datePublished\": \"2020-01-10T14:42:34+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:44:54+00:00\",\n\t            \"description\": \"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset\",\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\\\/neural-network-in-python-part-vii\\\/\"\n\t                    ]\n\t                }\n\t            ]\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\\\/e3e144de3dc01a5e3d3b01449fb26629\",\n\t            \"name\": \"Devang Singh\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/devangsingh\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Neural Network In Python \u2013 Part VII | IBKR Quant","description":"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset","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\/31047\/","og_locale":"en_US","og_type":"article","og_title":"Neural Network In Python \u2013 Part VII | IBKR Campus US","og_description":"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/","og_site_name":"IBKR Campus US","article_published_time":"2020-01-10T14:42:34+00:00","article_modified_time":"2022-11-21T14:44:54+00:00","author":"Devang Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Devang Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/"},"author":{"name":"Devang Singh","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e3e144de3dc01a5e3d3b01449fb26629"},"headline":"Neural Network In Python \u2013 Part VII","datePublished":"2020-01-10T14:42:34+00:00","dateModified":"2022-11-21T14:44:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/"},"wordCount":214,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"keywords":["Algo Trading","Backpropagation","Dataframe","Deep Learning","Deep Neural Networks","Forward propagation","Gradient Descent","Machine Learning","Neuron","NumPy","Pandas","Python","rsi Stochastic Gradient Descent","Talib","Williams %R"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Asia Pacific","Quant Development","Quant Regions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/","name":"Neural Network In Python \u2013 Part VII | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"datePublished":"2020-01-10T14:42:34+00:00","dateModified":"2022-11-21T14:44:54+00:00","description":"QuantInsti demonstrates how to import dataset by using the pandas library, and then stores the data a dataframe named dataset","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/neural-network-in-python-part-vii\/"]}]},{"@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\/e3e144de3dc01a5e3d3b01449fb26629","name":"Devang Singh","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/devangsingh\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/31047","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\/251"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=31047"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/31047\/revisions"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=31047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=31047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=31047"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=31047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}