<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Patricia Bassey on Medium]]></title>
        <description><![CDATA[Stories by Patricia Bassey on Medium]]></description>
        <link>https://medium.com/@pat_31297?source=rss-2aa61e700a9e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*A1fZkv-P8egofqsKSbpf6Q.jpeg</url>
            <title>Stories by Patricia Bassey on Medium</title>
            <link>https://medium.com/@pat_31297?source=rss-2aa61e700a9e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:53:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pat_31297/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Logistic Regression Vs Support Vector Machines (SVM)]]></title>
            <link>https://medium.com/axum-labs/logistic-regression-vs-support-vector-machines-svm-c335610a3d16?source=rss-2aa61e700a9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c335610a3d16</guid>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[classification-algorithms]]></category>
            <dc:creator><![CDATA[Patricia Bassey]]></dc:creator>
            <pubDate>Thu, 19 Sep 2019 14:26:02 GMT</pubDate>
            <atom:updated>2019-09-19T14:26:02.057Z</atom:updated>
            <content:encoded><![CDATA[<p>Logistic regression and support vector machines are supervised machine learning algorithms. They are both used to solve classification problems (sorting data into categories). It can be sometimes confusing knowing when to use either of these machine learning algorithms, I am going to provide guidelines on which to use depending on the amount of data or features that you have.</p><h3><strong>Logistic Regression</strong></h3><p>Logistic regression is an algorithm that is used in solving classification problems. It is a predictive analysis that describes data and explains the relationship between variables. Logistic regression is applied to an input variable (X) where the output variable (y) is a discrete value which ranges between 1 (yes) and 0 (no).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/107/1*qvE58DeCHz2Hgv3dQDfKfw.png" /></figure><p>It uses logistic (sigmoid) function to find the relationship between variables. The sigmoid function is an S-shaped curve that can take any real-valued number and map it to a value between 0 and 1, but never exactly at those limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXCBO-Wx5XhuY_OwMl0Phw.png" /><figcaption>Illustration of a Sigmoid Curve from <a href="https://en.wikipedia.org/wiki/Sigmoid_function">wikipedia</a></figcaption></figure><h4>Problems to apply logistic regression algorithm</h4><ol><li>Cancer detection — can be used to detect if a patient have cancer (1) or not(0).</li><li>Test score — predict if a student passed(1) or failed(0) a test.</li><li>Marketing — predict if a customer will purchase a product(1) or not(0).</li></ol><p>Here is a very detailed overview about <a href="https://towardsdatascience.com/logistic-regression-detailed-overview-46c4da4303bc">logistic regression</a> algorithm.</p><h3><strong>Support Vector Machine</strong></h3><p>The support vector machine is a model used for both classification and regression problems though it is mostly used to solve classification problems. The algorithm creates a hyperplane or line(decision boundary) which separates data into classes. It uses the kernel trick to find the best line separator (decision boundary that has same distance from the boundary point of both classes). It is a clear and more powerful way of learning complex non linear functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*QqpnpuTrG9UevIT5kBX3Zg.jpeg" /></figure><p>Here is a very detailed overview about <a href="https://towardsdatascience.com/support-vector-machine-introduction-to-machine-learning-algorithms-934a444fca47">support vector machine</a> algorithm.</p><h4>Problems that can be solved using SVM</h4><ol><li>Image classification</li><li>Recognizing handwriting</li><li>Caner detection</li></ol><h3><strong>Difference between SVM and Logistic Regression</strong></h3><ul><li>SVM tries to finds the “best” margin (distance between the line and the support vectors) that separates the classes and this reduces the risk of error on the data, while logistic regression does not, instead it can have different decision boundaries with different weights that are near the optimal point.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*sWXmiaVplPdP1Zrv-0xifA.png" /></figure><ul><li>SVM works well with unstructured and semi-structured data like text and images while logistic regression works with already identified independent variables.</li><li>SVM is based on geometrical properties of the data while logistic regression is based on statistical approaches.</li><li>The risk of overfitting is less in SVM, while Logistic regression is vulnerable to overfitting.</li></ul><h3><strong>When To Use Logistic Regression vs Support Vector Machine</strong></h3><p>Depending on the number of training sets (data)/features that you have, you can choose to use either logistic regression or support vector machine.</p><p>Lets take these as an example where :<br><em>n = number of features, <br>m = number of training examples</em></p><p>1. If <em>n is large (1–10,000) and m is small (10–1000)</em> : use logistic regression or SVM with a linear kernel.</p><p>2. If <em>n is small (1–10 00) and m is intermediate (10–10,000</em>) : use SVM with (Gaussian, polynomial etc) kernel</p><p>3. If <em>n is small (1–10 00), m is large </em>(50,000–1,000,000+): first, manually add more features and then use logistic regression or SVM with a linear kernel</p><p>Generally, it is usually advisable to first try to use logistic regression to see how the model does, if it fails then you can try using SVM without a kernel (is otherwise known as SVM with a linear kernel). Logistic regression and SVM with a linear kernel have similar performance but depending on your features, one may be more efficient than the other.</p><p>Logistic regression and SVM are great tools for training classification and regression problems. It is good to know when to use either of them so as to save computational cost and time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c335610a3d16" width="1" height="1" alt=""><hr><p><a href="https://medium.com/axum-labs/logistic-regression-vs-support-vector-machines-svm-c335610a3d16">Logistic Regression Vs Support Vector Machines (SVM)</a> was originally published in <a href="https://medium.com/axum-labs">Axum Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Vectorization” in Octave.]]></title>
            <link>https://medium.com/axum-labs/vectorization-in-octave-fa1fca921c43?source=rss-2aa61e700a9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa1fca921c43</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[vectorization]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[octave]]></category>
            <dc:creator><![CDATA[Patricia Bassey]]></dc:creator>
            <pubDate>Thu, 20 Jun 2019 14:42:30 GMT</pubDate>
            <atom:updated>2019-07-03T12:11:57.746Z</atom:updated>
            <content:encoded><![CDATA[<p>In machine learning, you will discover that there is usually a lot of linear numerical computations of varying complexity that needs to be done and in its raw state requires a lot of GPU power to carry out this computations. If you wanted to compute the sum of the values in an array, you will need to loop over each individual value before summing them up as you go. This process will be slow if you have large amounts of data. With vectorization, you can perform these operations much more efficiently without using loops because they will be seen as matrix operations.</p><p><strong>Vectorization is the process of converting an algorithm from operating on individual matrix elements one at a time, to operating on a batch of values in a single operation</strong>. That is, it uses a vector operations for computations instead of element-by-element operations.</p><p>Programing languages like Octave, C++, R, Python and Mathlab have different highly optimized numerical libraries that help you compute vectorized operations quickly. Here we will be looking at vectorization in Octave.</p><p>Octave is a matrix oriented programming language. Most octave functions are written with vector and array argument in mind. Vectorization is not only unique to Octave but it is also important since octave is matrix-based. Vectorization help produce a shorter and clean code in development process and aside from that, it also helps in better optimization for subsequent code implementation.</p><p>Let’s consider this simple operation — the addition of matrix a and b with the result being stored in a new matrix c:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*84Vb0byUq7EW4k8ukl36yw.png" /><figcaption>Unvectorized Code</figcaption></figure><p>The block of code above is implementing nested for loops. This will however take a long while to compute. The same code done with vectorization in octave is shown in a simpler code below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/1*CjKb8gQI6OnYD0hKnVtaaA.png" /><figcaption>Vectorised Code</figcaption></figure><p>So comparing the unvectorized and vectorized code, you can see that the vectorized code is a cleaner, shorter and easily computed line of code.</p><p>Let’s take a look at how to write vectorized format in Octave for some of the algorithms used in machine learning.</p><p>Below is a formula for a linear regression problem, which is a function that takes the input(<strong>x</strong>) and maps out an output (<strong>estimated value</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*Pkr28dVTKoo8EIBmnukLcA.png" /><figcaption>Formula for Linear Regression</figcaption></figure><p>The simple implementation of a linear regression problem would be written below, here you can see the sequential for loop that is needed to be executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*LYW9jqnM0zCxjWe1fiLS4Q.png" /><figcaption>Naive form for Hypothesis of Linear Regression</figcaption></figure><p>In contrast, the vectorized implementation of linear regression in octave is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*CRSTUfg0qHka08b0Ie5aXQ.png" /><figcaption>Vectorized form for Hypothesis of Linear Regression</figcaption></figure><p>In the vectorized form above, the prediction variable is the hypothesis (h), theta transpose (<strong>theta prime</strong>) multiplied by the input (<strong>x</strong>).</p><p>The cost function algorithm for linear regression problem. The formula below represents the cost function, which is the sum of the squared difference between the predicted value (<strong>h theta (x)</strong>)and the actual value(<strong>y</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*9_eR4cdfZelQGvu5F5rZrQ.png" /><figcaption>Cost function Formula</figcaption></figure><p>In contrast, below is the vectorized form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*zgPfb06sOe1C9MMBZs3wIg.png" /><figcaption>Vectorized form of Cost Function</figcaption></figure><p>This is a one liner that does the computation in a matrix operation which are fast. The goal of vectorization is to write code that is void of loops (such as <strong><em>for </em></strong>or <strong><em>while </em></strong>loops) but instead use whole array operations that are more efficient.</p><p>In summary, vectorization can be done in other languages like C++, Mathlab, Python but our main focus was on vectorization in Octave. We looked at the naive way of implementing some algorithms like hypothesis and cost function used in Machine learning and compared them to their vectorized forms. Vectorization can also be done on other algorithms that have not been mentioned here. So feel free to see if you can come up with vectorized forms of other algorithms.</p><p>Cheers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa1fca921c43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/axum-labs/vectorization-in-octave-fa1fca921c43">“Vectorization” in Octave.</a> was originally published in <a href="https://medium.com/axum-labs">Axum Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>