<?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 Mehmet Özkaya on Medium]]></title>
        <description><![CDATA[Stories by Mehmet Özkaya on Medium]]></description>
        <link>https://medium.com/@kayamemo168?source=rss-ba72071753ad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*evIb1adjuYh7BfDS</url>
            <title>Stories by Mehmet Özkaya on Medium</title>
            <link>https://medium.com/@kayamemo168?source=rss-ba72071753ad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 21:39:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kayamemo168/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[The Cost Function in Machine Learning]]></title>
            <link>https://medium.com/@kayamemo168/the-cost-function-in-machine-learning-7fe4bdc2e68d?source=rss-ba72071753ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fe4bdc2e68d</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[cost-function]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Mehmet Özkaya]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 15:54:17 GMT</pubDate>
            <atom:updated>2024-01-02T16:03:16.612Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone! Today we continue our machine learning adventure with <strong>the cost function</strong>. In our previous articles, we have talked about what is <strong>machine learning</strong> and its types, <strong>supervised</strong> and <strong>unsupervised learning</strong> and <strong>linear regression with one variable</strong>. In the article <a href="https://medium.com/@kayamemo168/linear-regression-with-one-variable-b08e5f9e6114"><strong>linear regression with one variable</strong></a>, we learned how does the <strong>linear regression</strong> work and we found our <strong><em>w</em></strong> and<strong><em> b</em></strong> values by trying. However, in this article, we are going to try finding these values by the help of <strong>the cost function</strong>.</p><p>First, let’s start with what is <strong>the cost function</strong>. <strong>The cost function</strong> basicly measures the performance of a machine learning model for given data. Let’s talk about <strong>linear regression</strong> beacuse we know something about it. In the previous article, we found our <strong><em>w</em></strong> and <strong><em>b</em></strong> values by trying. But it is not a good way to find these values. It needs too much time and effort. At this point, <strong>the cost function</strong> helps us.</p><h3>How does the cost function work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6eUSs3G7QCYt8gJnaRnbSA.png" /></figure><p>If you look at this formula, it may seem like it is not possible to understand it. However, if we start forming this formula from the beginning, you will absolutely understand its logic. First, let’s have a look at a <strong>linear regression</strong> example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*OLM_PhxsOgPj3_VCQl238g.png" /></figure><p>We know that <strong>linear regression model</strong> is a kind of <strong>linear function</strong>. We also know that the function behaves differently when we give different <strong><em>w </em></strong>and <strong><em>b </em></strong>values. As you can see in the graph we have <strong>inputs</strong> as <strong>x values</strong> and the <strong>outputs</strong> as <strong>y values</strong>. Each dot in the graph represent a single data <strong>(x, y)</strong> from the training set. In the formula ‘<strong><em>y’</em></strong> represents the outputs in the training set. Also we have<strong><em> ‘y-hat’</em></strong> in the formula and it represents the model function outputs with respect to the <strong><em>w</em></strong> and <strong><em>b </em></strong>values that we give. You can also rewrite ‘<strong><em>y-hat’</em></strong> as <strong>f(x[i])</strong> which also equals <strong><em>w</em> * x[<em>i</em>] + <em>b </em>(i’th element of x)</strong>. So as you can guess, we are subtracting the <strong>training set’s output values</strong> from the <strong>model function’s prediction outputs</strong>. We can visualize it like below. We actually measure the <strong>difference </strong>between the <strong>prediction </strong>and the <strong>output value</strong>, and take the square of this difference. You may ask why do we take the square of it. Actually, we have to do it for proper results. It has a mathematical proof but no need to explain it here. You can visit this <a href="https://datascience.stackexchange.com/questions/10188/why-do-cost-functions-use-the-square-error">link</a> if you want to learn it right now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL6tBatYu677YThuO2MlkQ.png" /></figure><p>We obtained our <strong>difference </strong>but we have to do it for all of the <strong>training set values</strong>. So we use <em>sigma </em>operation (for loop in coding) to do this task. It starts from <strong><em>i </em>= 1</strong> and do the same operation for all of the values in the <strong>training set</strong>. We learnt that <strong><em>m </em></strong>represents the number of data and we do this operation until we reach the last (<strong><em>m’th</em></strong>) data. Great, we learnt what does this notation mean :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*oSohg5RRTj1QmfcV9vmUOA.png" /></figure><p>We summed all of the <strong>differences </strong>between the <strong>training set outputs</strong> and the <strong>model function’s outputs</strong>. But we have to obtain a mean value to have ‘<strong><em>cost</em></strong>’. You can think this ‘<strong><em>cost</em></strong>’ as an <strong>error</strong>. So, we have to divide this value by the number of elements for which we calculated the error rate (basically the number of data = <strong><em>m</em></strong>). But wait, we have a problem. In the formula, we divide it by 2 times <strong><em>m</em></strong>. Also here, you can check this <a href="https://datascience.stackexchange.com/questions/10188/why-do-cost-functions-use-the-square-error">link</a> to know why. It is basically for more proper and better results. Finally, we have reached the form of <strong>the cost function</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*Q2OBgKXtm0jzLwjECn-RFw.png" /></figure><p>As you can see, we have done some operations and obtained a ‘<strong><em>cost</em></strong>’ or we can say an <strong>error</strong>. We have done it for a single set of <strong><em>w</em></strong> and <strong><em>b</em></strong>. As you remember, ‘<strong><em>y-hat</em></strong>’ represents the <strong>output of the model function</strong> and we created this function by giving the values <strong><em>w </em></strong>and <strong><em>b</em></strong>. So, this<strong> cost function</strong> calculated the <strong>error </strong>or ‘<strong><em>cost</em></strong>’ for a single function with constant <strong><em>w </em></strong>and <strong><em>b </em></strong>values, which means we can obtain different ‘<strong><em>costs</em></strong>’ or <strong>errors </strong>by giving different <strong><em>w </em></strong>and <strong><em>b </em></strong>values. At the end, if we want to choose the <strong>best model function</strong>, we can choose the one which <strong>the cost function</strong> gives us the <strong>smallest error</strong> with it. And here how <strong>the cost function</strong> helps us to find the <strong>best model function</strong> in <strong>linear regression</strong>.</p><h3>Conclusion</h3><p>We finally managed to learn how does <strong>the cost function</strong> work. We have different ‘<strong><em>costs</em></strong>’ or <strong>errors </strong>for each <strong>model function</strong> with different <strong><em>w </em></strong>and <strong><em>b </em></strong>values. By the help of <strong>the cost function</strong>, we can choose the <strong>best fitting line</strong> or <strong>the best model function</strong>. But we can’t try all of the <strong><em>w </em></strong>and <strong><em>b </em></strong>values by hand so we have to use another tool to help us, <strong>the gradient descent</strong>. In the next article, we are going to talk about <strong>the gradient descent</strong>. We will discuss what is the relation between <strong>the cost function</strong> and <strong>the gradient descent</strong>, how does it choose the <strong><em>w </em></strong>and <strong><em>b</em></strong> values automatically and finally how does it find the best <strong><em>w </em></strong>and <strong><em>b </em></strong>values for the <strong>model function</strong>.</p><p>Thank you so much for reading. If I could give you some information about <strong>the cost function</strong>, it will make me very happy. You can e-mail me if you have see any problem in the article or give me a feedback. Have a good day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fe4bdc2e68d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Regression with One Variable]]></title>
            <link>https://medium.com/@kayamemo168/linear-regression-with-one-variable-b08e5f9e6114?source=rss-ba72071753ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/b08e5f9e6114</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[linear-regression-model]]></category>
            <category><![CDATA[linear-regression-example]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[linear-regression-python]]></category>
            <dc:creator><![CDATA[Mehmet Özkaya]]></dc:creator>
            <pubDate>Fri, 29 Dec 2023 09:43:52 GMT</pubDate>
            <atom:updated>2023-12-29T09:43:52.712Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we are going to learn what is <strong>linear regression</strong>. We have talked about what is <strong>regression</strong> and what is the difference between <strong>classification</strong> and <strong>regression</strong>. You know we have infinite amount of prediction values in <strong>regression </strong>while we have only few amount of prediction values in <strong>classification</strong>. In simple <strong>linear regression</strong>, we are going to investigate the correlation between dependent and independent values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*vOgMa_c2t7TcCdVUs9jRjQ.jpeg" /><figcaption>Figure 0</figcaption></figure><p>In this graph, we know that each red dot represent a single data in the dataset. In <strong>linear regression</strong>, we are trying to find the best line which goes through between these red dots perfectly. This line actually represents the <strong>model</strong> that we trained. After we train that <strong>model</strong> and find the perfect line, it is also a <strong>linear function</strong>, we can give any input to the <strong>model</strong> and get a prediction. First let’s start from the begginning and learn some terms about <strong>linear regression</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*UdjJbJ5rfqmTBKzoZkpxRw.png" /><figcaption>Figure 1</figcaption></figure><h3>Terminology</h3><blockquote><strong>Training Set :</strong> Training set is the dataset that is used to train the model. In Figure 1, each red dot represents a single data in the training set. In this example we have years of experience as inputs and salaries as ouputs.</blockquote><blockquote><strong>The model :</strong> The model is used to predict some output values for each input we give to the model. In linear regression, we are going to give the training set to the linear machine learning algorithm and it will find the perfect fitting line, model, for us.</blockquote><h3>How To Create The Model / The Best Fitting Line</h3><p>We learned the in <strong>linear regression</strong>, our <strong>model function</strong> is also a <strong>linear function</strong>. You know, <strong>linear functions</strong> are represented as <strong>f(x) = <em>w</em>x + <em>b</em></strong>. Both <strong><em>w </em></strong>and <strong><em>b </em></strong>are the constants and when they are changed, the behaviour of our function also changes. Here are some examples;</p><ul><li>If we assign <strong><em>w</em></strong> as 3 and <strong><em>b</em></strong> as 2, we will have the function in Figure 2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*uQ93JMEgloyiUQR7cqVTLg.png" /><figcaption>Figure 2</figcaption></figure><ul><li>If we assign <strong><em>w</em></strong> as 2 and <strong><em>b</em></strong> as 2, we will have the function in Figure 3.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*4Nbxr7HUSqdofXX4jF0A0g.png" /><figcaption>Figure 3</figcaption></figure><ul><li>And here are some other examples in a single Figure.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hScsrCnyWC_Il_sqjNVpvA.jpeg" /></figure><p>As you can see, we can obtain different types of <strong>linear functions</strong> by changing the values of <strong><em>w</em></strong> and <strong><em>b</em></strong>. Also in <strong>linear regression</strong>, our algorithm will try to find the best <strong><em>w</em></strong> and <strong><em>b</em></strong> values for the training set. Later we can give any input to that <strong>model </strong>for prediction.</p><h3>How To Implement To Python Code</h3><p>Firstly, we have to implement the necessary modules :</p><pre>import numpy as np<br>import matplotlib.pyplot as plt</pre><p>Then, we have to define our training set. <strong><em>x_train</em></strong> values represents the experience in the sector and <strong><em>y_train</em></strong> values represents the salary annually. In addition we are going to use the variable <strong><em>m</em></strong> to represent the number of data in the training set :</p><pre>x_train = np.array([5.0, 10.0])<br>y_train = np.array([180.0, 250.0])<br>m = x_train.shape[0]</pre><p>Let’s plot the data :</p><pre>plt.scatter(x_train, y_train, marker=&#39;x&#39;, c=&#39;r&#39;)<br>plt.title(&quot;Experiences - Salaries&quot;)<br>plt.ylabel(&#39;Salary (in 1000s of dollars)&#39;)<br>plt.xlabel(&#39;Experience (years)&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*5ZEdGVJwzrUvGv99LVozLw.png" /></figure><p>Here as you can see we plotted the data on a graph. Next we have to find the best fitting line for this data.</p><p>In a for loop, we can access all of the data seperately.</p><pre>for i in range(m):<br>  print(x_train[i], y_train[i])</pre><p>[ 5. 10.] [180. 250.]</p><p>Later, we can give some <strong><em>w</em></strong> and <strong><em>b</em></strong> values and investigate them in a graph. Let’s try <strong><em>w</em></strong> = 100 and <strong><em>b</em></strong> = 100 :</p><pre>w = 100<br>b = 100</pre><p>Now, we can create our model to try these values. We know that our function is <strong>f(x) = <em>w</em>x + <em>b</em></strong> :</p><pre>def create_model(x, w, b):<br>  m = x.shape[0]<br>  f_wb = np.zeros(m)<br>  print(f_wb)<br>  for i in range(m):<br>      f_wb[i] = w * x[i] + b<br>  print(f_wb)<br>  return f_wb</pre><p>Now let’s call the create_model function and plot the output :</p><pre>model = create_model(x_train, w, b)<br><br>plt.plot(x_train, model, c=&#39;b&#39;,label=&#39;Our Prediction&#39;)<br>plt.scatter(x_train, y_train, marker=&#39;x&#39;, c=&#39;r&#39;,label=&#39;Actual Values&#39;)<br>plt.title(&quot;Experiences - Salaries&quot;)<br>plt.ylabel(&#39;Salary (in 1000s of dollars)&#39;)<br>plt.xlabel(&#39;Experience (years)&#39;)<br>plt.legend()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*-oOLyaquHwKY6Uxi50z4jA.png" /></figure><p>As you can see, we couldn’t get the perfect line for this dataset. Suppose that <strong><em>w </em></strong>= 14 and <strong><em>b</em></strong> = 110. We are going to obtain this graph :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*l7CMGYHkSIouTxFVUDYo_g.png" /></figure><p>Here our line perfectly fit the data. In this example, we found our <strong><em>w</em></strong> and <strong><em>b</em></strong> by trying some values. Actually there is a much more easier way to find these values but we are going to talk about them later.</p><p>Now, we have a <strong>model </strong>which fits the data perfectly. Our <strong>model function</strong> is <strong>f(x) = 14x + 110 (<em>w</em> = 14, <em>b</em> = 110)</strong>. Let’s give some experience values as inputs and get salaries as outputs.</p><h4>f(6) = 14 * 6 + 110 = 194</h4><h4>f(7) = 14 * 7 + 110 = 208</h4><h4>f(8) = 14 * 8 + 110 = 222</h4><p>As you can see, we can obtain some prediction results by the help of our model. In <strong>linear regression</strong>, we can get some predictions by following the steps above. But as I said, there is a much more better way to find <strong><em>w</em></strong> and <strong><em>b</em></strong> values. So in the next articles, we are going to talk about <strong>the Cost Function</strong> and <strong>the Gradient Descent</strong>.</p><h3>Conclusion</h3><p>Thank you so much for reading until here. If I could give you some knowledge about <strong>Linear Regression</strong>, it will make me very happy. If you find some mistakes or if you want to give me a feedback, you can e-mail me. Have a good day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b08e5f9e6114" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unsupervised Learning]]></title>
            <link>https://medium.com/@kayamemo168/unsupervised-learning-c56439fb8a06?source=rss-ba72071753ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/c56439fb8a06</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[clustering-algorithm]]></category>
            <dc:creator><![CDATA[Mehmet Özkaya]]></dc:creator>
            <pubDate>Thu, 21 Dec 2023 11:05:22 GMT</pubDate>
            <atom:updated>2023-12-21T11:05:22.687Z</atom:updated>
            <content:encoded><![CDATA[<p>In supervised learning, we gave both inputs and outputs to the machine and the supervised learning algorithms are trained with it. In unsupervised learning, we don’t give outputs to the machine. Algorithms learn patterns exclusively from unlabeled data. We have inputs and we want machine to find odd, strange things and the differences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*UwalmUC-i5Ipn6I3mUlXaQ.png" /></figure><p>Unsupervised learning algorithms investigate the data and group them. Let me give you an example. Suppose that you have an advertisement company and you want to show your advertisements which the customers are interested in. So you have to group your customers by looking at the links they visited, the words they searched or the places they have been. As you can see, we have inputs but we don’t have any specific output. To do this job, we have to use unsupervised machine learning algorithms because we don’t have outputs in data. For this data we can use clustering machine learning algorithm. Clustering algorithm groups unlabeled examples. Let me visualise it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jbaXlMkHmJjHsECXgDzXBQ.png" /></figure><p>As you can see we have three feature and each of them represents an input. They can be the links they visited, the place they have been or the words they searched. Clustering algorithm groups these customers by looking their interests and we can show the proper advertisements. But be careful that this machine learning model can not say the interests of any customer. It can only group them into clusters and it is the main difference between supervised and unsupervised learning.</p><p>There are also many real life examples such as Google News. Google News investigates thousands of news and clusters them everyday. It finds similar words in the news and groups them.</p><h3>Unsupervised Learning Algorithms:</h3><p>As you can guess, there many unsupervised machine learning algorithms in the world and we used clustering algorithm in the previous example. The characteristic feature of unsupervised machine learning algorithms is that data only comes with inputs but no output labels. Here is three the most common ones:</p><p><strong><em>1- Clustering:</em></strong> Groups similar datapoints together.</p><p><strong><em>2- Anomaly Detection:</em></strong> Find unusual data point. (For ex: Detect unusual progress in financial.)</p><p><strong><em>3- Dimensionality Reduction</em></strong>: Compare data using fewer numbers.</p><h3>Differences Between Supervised and Unsupervised Machine Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*h-ZfDHFolRtheNpWW-4ddA.png" /><figcaption>Figure 1</figcaption></figure><p>In supervised learning, the data have inputs and outputs both together. The supervised learning algorithm uses this data to train the model and then the model can predict anything. We have absolute outputs in supervised learning. However, in unsupervised learning, the data doesn’t have outputs. Unsupervised learning algorithm investigates the data and clusters them. As you can see in Figure 1, unsupervised learning algorithm groups the inputs into clusters while supervised learning algorithm trying to draw the best seperating line by looking at the outputs. After you finish training your model with supervised learning algorithm, if you give any input to the model, it can produce an output for you. But if you do the same thing with unsupervised learning, the model is not able to produce an output for you, it can only cluster it.</p><p>Thanks for reading until here. If you learned something new, that will make me very happy. If you want to give me a feedback or find something wrong, you can send me an email. Have a great day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c56439fb8a06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Machine Learning and Supervised Machine Learning]]></title>
            <link>https://medium.com/@kayamemo168/what-is-machine-learning-and-supervised-machine-learning-5a71f2dbbc20?source=rss-ba72071753ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a71f2dbbc20</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[supervised-classification]]></category>
            <dc:creator><![CDATA[Mehmet Özkaya]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 19:48:23 GMT</pubDate>
            <atom:updated>2023-12-30T19:14:03.578Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1Ny0lK4EiauptCpUQhaVg.jpeg" /><figcaption>Machine Learning</figcaption></figure><p>Nowadays, people try to compete with machine. We as humans can learn, research, guess and dream something. We know that machines are not capable of doing them but that does not mean they will never be. So, can the machines do the same thing like us?</p><p>Machine learning is a type of artificial intelligence focused on building computer systems that learn from data. We prepare the data and give it to the machines to learn from them. Then, machine learning algorithms are trained to find relationships and patterns in data.</p><p>There are the three most common types of machine learning and <strong>supervised learning</strong> is one of them:</p><h3>1- Supervised Learning:</h3><p>In <strong>supervised learning</strong>, machine learns the relation between the input and the output label. The characteristic of <strong>supervised learning</strong> is that we give the learning algorithm examples to learn from. We give some examples which include inputs and outputs and the learning algorithm learns from them. And after all, when we give only the input, the machine can guess what the output should be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*3LblE2wJGEf2x0PgijJtTg.jpeg" /><figcaption>Inputs and outputs</figcaption></figure><p>We can use <strong>supervised learning</strong> in spam filtering, speech recognation, machine translation, online advertising, self driving cars and visual inspection.</p><p>Let me give you an example about <strong>supervised learning</strong> to make it more clear. Suppose that we have a data which contains lots of car models, their motor volume, their release date and prices. We give this data to machine to learn from and machine learning algorithm are trained with the data. Then, we obtain a trained model which can guess the price of any given car. Let’s visualize it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*Bkh-4Dwu0nQtPGwqFXANtQ.png" /></figure><p>These red points represent our data. Our <strong><em>x-axis</em></strong> is the motor volume and <strong><em>y-axis</em></strong> is the prices of the cars. (Numbers in x and y-axis are only for visualization. They do not represent the real values.) And we are using <strong>linear regression</strong> (it is one of the <strong>supervised machine learning</strong> algorithm) to train the model. <strong>Linear regression algorithm</strong> trying to find the best linear function for the data. We can also say that it is trying to draw the best line between the data. When it finds the most accurate one, we can give some inputs to the model to produce some outputs. (We give motor volume and the machine guesses the price.)</p><p>We used <strong>linear regression</strong> for this data. But what is regression? <strong>Regression</strong> is useful when we are trying to predict a number from infinitely many possible outputs.</p><p>There are many <strong>supervised learning</strong> methods and <strong>classification</strong> is the other one. <strong>Classification</strong> is a supervised machine learning method where the model tries to predict the correct label of a given input data. The best way to understand the <strong>classification</strong> is giving an example.</p><p>Let’s say that we have a data which contains the temparature of a crocodile’s egg and the gender of that egg. We know that the temparature of the egg is very important for the gender of the crocodile. The model is trained with that data by using <strong>classification</strong> method. Realise that we have only two outputs, male and female. The temparature can change but the output can not be different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*fd1Hmg1DUQgw9pvRctefDA.png" /></figure><p>As you can see we only have two possible option. (male and female) But it does not mean that we always have two outputs. It can be more that two possibilities. In addition, <strong>classification</strong> outputs can also be called as a <strong>class</strong> or <strong>category</strong>.</p><p><strong>Classification</strong> models predict categories. Also categories don’t have to be a number. They can also be non-numeric. They can be an image and machine learning model can decide if it is a cat or dog. Moreover, there can be more than one input. For instance, we can also take the size of the eggs for this dataset.</p><h3>Differences Between Regression and Classification:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gF2uPznf3ihBftaS4eoxTw.png" /></figure><p>The biggest difference from <strong>regression</strong>, we have obvious small number of possible outputs. As we said we have infinite possible outputs in <strong>regression</strong>. Also <strong>regression</strong> is trying to find the best line between each dots while <strong>classification</strong> is trying the draw a boundary between different outputs.</p><p>Thanks for reading. If you learned something new, it will make me very happy. If you want to ask any question or find something wrong, you can notify me via email. Have a good day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a71f2dbbc20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>