{"id":9619,"date":"2025-07-10T10:45:01","date_gmt":"2025-07-10T08:45:01","guid":{"rendered":"https:\/\/www.kubicek.ai\/?post_type=lexicon&#038;p=9619"},"modified":"2026-07-27T13:54:38","modified_gmt":"2026-07-27T11:54:38","slug":"logistic-regression","status":"publish","type":"lexicon","link":"https:\/\/www.kubicek.ai\/en\/lexicon\/logistic-regression\/","title":{"rendered":"Logistic regression"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Logistic regression<\/strong> is a statistical method and one of the basic machine learning algorithms, used for classification tasks. Despite its name it therefore does not serve for regression (predicting a continuous value) but for predicting the probability that a given input point belongs to a particular category.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How logistic regression works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At the heart of logistic regression lies the logistic function, also known as the sigmoid function, f(x) = 1\/(1+e\u207b\u02e3). This function has the characteristic &#8220;S&#8221; shape and converts any input into an output in the range from 0 to 1. That output can be interpreted as a probability.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The process runs in two main steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Computing a score<\/strong>: the model first computes a weighted sum of the input features, much as in linear regression. The result is a single number that may be arbitrarily large or small.<\/li>\n\n\n\n<li><strong>Applying the logistic function<\/strong>: this number is fed into the logistic function, which &#8220;squashes&#8221; it into the interval (0, 1). The result is a probability.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For the final decision a threshold is applied, usually 0.5. If the computed probability is higher than 0.5, the data point is assigned to class 1 (&#8220;spam&#8221;, say). If it is lower, it belongs to class 0 (&#8220;not spam&#8221;).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Types of logistic regression<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">According to the number and nature of the categories, three main types are distinguished:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Binary logistic regression<\/strong>: the commonest type, addressing problems with two possible outcomes (yes\/no, true\/false). Example: predicting whether a customer will repay a loan or default.<\/li>\n\n\n\n<li><strong>Multinomial logistic regression<\/strong>: used for problems with more than two categories that are independent of one another and have no natural ordering. Example: classifying a picture of an animal into the categories dog, cat or bird.<\/li>\n\n\n\n<li><strong>Ordinal logistic regression<\/strong>: used in situations where there are more than two categories but they have a meaningful order or ranking. Example: rating customer satisfaction on a scale of low, medium, high.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages and disadvantages<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Despite the existence of more advanced methods, logistic regression remains very popular, for several reasons.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Advantages<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simplicity and speed<\/strong>: it is computationally very efficient, fast to train and undemanding of resources.<\/li>\n\n\n\n<li><strong>Interpretability<\/strong>: the model&#8217;s results are easy to understand. You can see exactly what influence (weight) each input feature has on the final result, which is crucial in fields such as medicine or finance.<\/li>\n\n\n\n<li><strong>Good as a baseline model<\/strong>: thanks to its simplicity it serves as an excellent starting point for testing and comparison with more complex models.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Disadvantages<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Assumption of linearity<\/strong>: the model assumes a linear relationship between the input features and the outcome. If the relationship is complex and non-linear, the model may perform poorly.<\/li>\n\n\n\n<li><strong>Sensitivity to outliers<\/strong>: extreme values in the data can significantly affect the results.<\/li>\n\n\n\n<li><strong>Limited performance<\/strong>: on complex problems such as image recognition it usually does not reach the accuracy of more advanced models such as neural networks.<\/li>\n<\/ul>\n","protected":false},"featured_media":0,"template":"","class_list":["post-9619","lexicon","type-lexicon","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/lexicon\/9619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/lexicon"}],"about":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/types\/lexicon"}],"wp:attachment":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/media?parent=9619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}