{"id":203655,"date":"2024-03-20T11:27:07","date_gmt":"2024-03-20T15:27:07","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=203655"},"modified":"2024-03-20T11:27:13","modified_gmt":"2024-03-20T15:27:13","slug":"machine-learning-logistic-regression-python-trading-and-more-part-i","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/","title":{"rendered":"Machine Learning Logistic Regression: Python, Trading and More &#8211; Part I"},"content":{"rendered":"\n<p>Imagine a world where you can predict market movements with uncanny accuracy, where gut feelings give way to data-driven insights, and where every trade is a calculated step towards profit. This, my friend, is the alluring promise of machine learning in trading.<\/p>\n\n\n\n<p>Among the many algorithms vying for dominance in this arena, logistic regression stands out as a versatile and beginner-friendly tool. But how exactly does it work in the world of trading?<\/p>\n\n\n\n<p>Think of Machine learning logistic regression as a binary classifier. It analyses mountains of historical data \u2013 prices, volumes, indicators \u2013 and learns to distinguish between two distinct outcomes: up or down. Delve into the intricacies of logistic regression in machine learning for trading as we harness its capabilities to forecast stock price movements using Python.<\/p>\n\n\n\n<p>This blog covers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is logistic regression?<\/li>\n\n\n\n<li>Linear regression and logistic regression<\/li>\n\n\n\n<li>Example of logistic regression in trading<\/li>\n\n\n\n<li>Types of logistic regression<\/li>\n\n\n\n<li>Logistic regression vs linear regression<\/li>\n\n\n\n<li>Key assumptions while using logistic regression<\/li>\n\n\n\n<li>Steps to use logistic regression<\/li>\n\n\n\n<li>How to use logistic regression in Python for trading?<\/li>\n\n\n\n<li>Challenges of logistic regression<\/li>\n\n\n\n<li>Overcoming the challenges of logistic regression<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>Machine learning tasks generally bifurcate into two realms:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The expected outcome is defined<\/li>\n\n\n\n<li>The expected outcome is not defined<\/li>\n<\/ol>\n\n\n\n<p>The former characterised by input data paired with labelled outputs, is termed supervised learning. Conversely, when input data lacks labelled responses, that is, in the latter case, it&#8217;s known as unsupervised learning. Explore the &#8216;<a href=\"https:\/\/quantra.quantinsti.com\/course\/unsupervised-learning-trading\">unsupervised learning course<\/a>&#8216; from Quantra.<\/p>\n\n\n\n<p>Additionally, there&#8217;s reinforcement learning, which refines models through iterative feedback to enhance performance. Now, we explore Machine Learning Logistic Regression.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-logistic-regression\">What is logistic regression?<\/h2>\n\n\n\n<p>Logistic regression falls under the category of supervised learning; it measures the relationship between the categorical dependent variable and one or more independent variables by estimating probabilities using a logistic\/sigmoid function.<\/p>\n\n\n\n<p>It is primarily used for binary classification problems where the outcome can take on only two possible categorical values, often denoted as 0 and 1. Some examples are, &#8220;success&#8221; or &#8220;failure&#8221;, &#8220;spam&#8221; or &#8220;not spam&#8221;, etc.<\/p>\n\n\n\n<p>Despite the name \u2018logistic regression\u2019, this is not used for&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/trading-with-machine-learning-regression\">machine learning regression<\/a>&nbsp;problems where the task is to predict the real-valued output. It is a classification problem which is used to predict a binary outcome (1\/0, -1\/1, True\/False) given a set of independent variables.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"linear-regression-and-logistic-regression\">Linear regression and logistic regression<\/h2>\n\n\n\n<p>Logistic regression is a bit similar to linear&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/statistics-for-basic-stock-trading-iii\/\">regression<\/a>, or we can say it is a generalised linear model. In linear regression, we predict a real-valued output &#8216;y&#8217; based on a weighted sum of input variables.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"650\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Linear-regression-1-quantinsti.png\" alt=\"\" class=\"wp-image-203657 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Linear-regression-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Linear-regression-1-quantinsti-700x632.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Linear-regression-1-quantinsti-300x271.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/650;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\">y = c + x<sub>1<\/sub> \u2217 w<sub>1<\/sub> + x<sub>2<\/sub> \u2217 w<sub>2<\/sub> + x<sub>3<\/sub> \u2217 w<sub>3<\/sub> + &#8230;&#8230;.. + x<sub>n<\/sub> \u2217 w<sub>n<\/sub><\/p>\n\n\n\n<p>The aim of linear regression is to estimate values for the model coefficients c, w1, w2, w3 \u2026.wn and fit the training data with minimal squared error and predict the output y.<\/p>\n\n\n\n<p>Machine learning Logistic regression does the same thing but with one addition. The logistic regression model computes a weighted sum of the input variables similar to the linear regression, but it runs the result through a special non-linear function, the logistic function or sigmoid function to produce the output y. Here, the output is binary or in the form of 0\/1 or -1\/1.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"694\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Logistic-regression-quantinsti.png\" alt=\"\" class=\"wp-image-203663 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Logistic-regression-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Logistic-regression-quantinsti-700x675.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Logistic-regression-quantinsti-300x289.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/694;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\">y = logistic(c + x<sub>1<\/sub> \u2217 w<sub>1<\/sub> + x<sub>2<\/sub> \u2217 w<sub>2<\/sub> + x<sub>3<\/sub> \u2217 w<sub>3<\/sub> + &#8230;&#8230;.. + x<sub>n<\/sub> \u2217 w<sub>n<\/sub>)<\/p>\n\n\n\n<p class=\"has-text-align-center\">y=1\/1 + e[\u2212(c + x<sub>1<\/sub> \u2217 w<sub>1<\/sub> + x<sub>2<\/sub> \u2217 w<sub>2<\/sub> + x<sub>3<\/sub> \u2217 w<sub>3<\/sub> + &#8230;&#8230;.. + x<sub>n<\/sub> \u2217 w<sub>n<\/sub>)]<\/p>\n\n\n\n<p>The sigmoid\/logistic function is given by the following equation.<\/p>\n\n\n\n<p><em>y = 1 \/ 1+ e-x<\/em><\/p>\n\n\n\n<p>As you can see in the graph, it is an S-shaped curve that gets closer to 1 as the value of the input variable increases above 0 and gets closer to 0 as the input variable decreases below 0.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"570\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Sigmoid-fumction-quantinsti.png\" alt=\"\" class=\"wp-image-203672 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Sigmoid-fumction-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Sigmoid-fumction-quantinsti-700x554.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/03\/Sigmoid-fumction-quantinsti-300x238.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/570;\" \/><\/figure>\n\n\n\n<p>In the context of Machine learning logistic regression, the decision boundary is commonly set at 0.5, meaning that if the predicted probability is greater than 0.5, the outcome is classified as 1 (positive), and if it is less than 0.5, the outcome is classified as 0 (negative).<\/p>\n\n\n\n<p>Now, let us consider the task of&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/use-decision-trees-machine-learning-predict-stock-movements\/\">predicting the stock price<\/a>&nbsp;movement. If tomorrow\u2019s closing price is higher than today\u2019s closing price, then we will buy the stock (1), else we will sell it (-1). If the output is 0.7, then we can say that there is a 70% chance that tomorrow\u2019s closing price is higher than today\u2019s closing price and classify it as 1.<\/p>\n\n\n\n<p><em>Author: Chainika Thakar (Originally written By Vibhu Singh)<\/em><\/p>\n\n\n\n<p><em>Stay tuned for Part II to learn about logistic regression in trading.<\/em><\/p>\n\n\n\n<p><em>Originally posted on <a href=\"https:\/\/blog.quantinsti.com\/machine-learning-logistic-regression-python\/\">QuantInsti<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Delve into the intricacies of logistic regression in machine learning for trading as we harness its capabilities to forecast stock price movements using Python.<\/p>\n","protected":false},"author":186,"featured_media":197427,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341],"tags":[851,16846,4405,852,595,16847],"contributors-categories":[13654],"class_list":{"0":"post-203655","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-logistic-function","14":"tag-logistic-regression","15":"tag-machine-learning","16":"tag-python","17":"tag-sigmoid-function","18":"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>Machine Learning Logistic Regression: Python, Trading and More &#8211; Part I<\/title>\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\/203655\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Machine Learning Logistic Regression: Python, Trading and More - Part I\" \/>\n<meta property=\"og:description\" content=\"Delve into the intricacies of logistic regression in machine learning for trading as we harness its capabilities to forecast stock price movements using Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-20T15:27:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-20T15:27:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.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=\"Contributor Author\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Contributor Author\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Contributor Author\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e823e46b42ca381080387e794318a485\"\n\t            },\n\t            \"headline\": \"Machine Learning Logistic Regression: Python, Trading and More &#8211; Part I\",\n\t            \"datePublished\": \"2024-03-20T15:27:07+00:00\",\n\t            \"dateModified\": \"2024-03-20T15:27:13+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/\"\n\t            },\n\t            \"wordCount\": 741,\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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Logistic Function\",\n\t                \"Logistic Regression\",\n\t                \"Machine Learning\",\n\t                \"Python\",\n\t                \"Sigmoid Function\"\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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/\",\n\t            \"name\": \"Machine Learning Logistic Regression: Python, Trading and More - Part I | 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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"datePublished\": \"2024-03-20T15:27:07+00:00\",\n\t            \"dateModified\": \"2024-03-20T15:27:13+00:00\",\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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/\"\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\\\/machine-learning-logistic-regression-python-trading-and-more-part-i\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\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\\\/e823e46b42ca381080387e794318a485\",\n\t            \"name\": \"Contributor Author\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/contributor-author\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Machine Learning Logistic Regression: Python, Trading and More &#8211; Part I","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\/203655\/","og_locale":"en_US","og_type":"article","og_title":"Machine Learning Logistic Regression: Python, Trading and More - Part I","og_description":"Delve into the intricacies of logistic regression in machine learning for trading as we harness its capabilities to forecast stock price movements using Python.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/","og_site_name":"IBKR Campus US","article_published_time":"2024-03-20T15:27:07+00:00","article_modified_time":"2024-03-20T15:27:13+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","type":"image\/jpeg"}],"author":"Contributor Author","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Contributor Author","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/"},"author":{"name":"Contributor Author","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e823e46b42ca381080387e794318a485"},"headline":"Machine Learning Logistic Regression: Python, Trading and More &#8211; Part I","datePublished":"2024-03-20T15:27:07+00:00","dateModified":"2024-03-20T15:27:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/"},"wordCount":741,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","keywords":["Algo Trading","Logistic Function","Logistic Regression","Machine Learning","Python","Sigmoid Function"],"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\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/","name":"Machine Learning Logistic Regression: Python, Trading and More - Part I | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","datePublished":"2024-03-20T15:27:07+00:00","dateModified":"2024-03-20T15:27:13+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/machine-learning-logistic-regression-python-trading-and-more-part-i\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","width":1000,"height":563,"caption":"Quant"},{"@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\/e823e46b42ca381080387e794318a485","name":"Contributor Author","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/contributor-author\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/203655","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\/186"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=203655"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/203655\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/197427"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=203655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=203655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=203655"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=203655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}