<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: user</title>
    <description>The latest articles on DEV Community by user (@user000001).</description>
    <link>https://dev.to/user000001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F371643%2F8cd9b59f-e75b-4512-95f4-7ee3f9016664.jpeg</url>
      <title>DEV Community: user</title>
      <link>https://dev.to/user000001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/user000001"/>
    <language>en</language>
    <item>
      <title>Common myths about coding you should ignore</title>
      <dc:creator>user</dc:creator>
      <pubDate>Tue, 22 Sep 2020 00:04:55 +0000</pubDate>
      <link>https://dev.to/user000001/common-myths-about-coding-you-should-ignore-3c7n</link>
      <guid>https://dev.to/user000001/common-myths-about-coding-you-should-ignore-3c7n</guid>
      <description>&lt;p&gt;So today I'm gonna be busting myths about programming because I hear a lot of people view coding as a way that isn't reality.&lt;br&gt;
Let's start:&lt;/p&gt;

&lt;h3&gt;
  
  
  • Programming requires a lot of math
&lt;/h3&gt;

&lt;p&gt;A lot of people think that to become a good programmer you need to become good at math and this makes a lot of people that want to enter the field of programming very discouraged. For general programming, you need basic math like; &lt;strong&gt;addition&lt;/strong&gt;, &lt;strong&gt;subtraction&lt;/strong&gt;, &lt;strong&gt;division&lt;/strong&gt;, &lt;strong&gt;multiplication&lt;/strong&gt;, and other basic math we've learned. Just know that there are some areas of &lt;strong&gt;programming&lt;/strong&gt; that require &lt;strong&gt;more math&lt;/strong&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  • It's a young man's game
&lt;/h3&gt;

&lt;p&gt;It doesn't matter if you are &lt;strong&gt;30, 40, 50.&lt;/strong&gt; When it comes to coding, &lt;strong&gt;age is not a factor&lt;/strong&gt;. Anyone can learn to code. What matters is how &lt;strong&gt;much effort&lt;/strong&gt; you are willing to put into it. &lt;/p&gt;

&lt;h3&gt;
  
  
  • It's for the anti-social
&lt;/h3&gt;

&lt;p&gt;Wrong, &lt;strong&gt;coding is for everyone&lt;/strong&gt;. During coding, not only are you &lt;strong&gt;communicating with your computer&lt;/strong&gt; but you would also need to communicate with other developers when you need help with your code.  A career as a developer is a &lt;strong&gt;very social one&lt;/strong&gt;. While working on projects either in your team or by yourself, you will need to &lt;strong&gt;exchange thoughts&lt;/strong&gt; and ideas with others. Surely you will spend a good amount of your &lt;strong&gt;time-solving problems by yourself&lt;/strong&gt;. All coding projects involve a great deal of intense logical thinking and brainstorming but when you need help there would always be a community of your fellow developers to help you.&lt;/p&gt;

&lt;h3&gt;
  
  
  • I need to be very smart to learn to code
&lt;/h3&gt;

&lt;p&gt;What matters about &lt;strong&gt;coding&lt;/strong&gt; is your &lt;strong&gt;motivation&lt;/strong&gt; and &lt;strong&gt;hard work&lt;/strong&gt;. To become a &lt;strong&gt;better programmer&lt;/strong&gt; what matters most is your &lt;strong&gt;consistency&lt;/strong&gt;. That is why I advise new programmers to participate in the &lt;strong&gt;100DaysOfCode challenge&lt;/strong&gt;, it helps to &lt;strong&gt;increase consistency&lt;/strong&gt; and &lt;strong&gt;familiarity&lt;/strong&gt; with &lt;strong&gt;programming&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  • I need special qualifications to get into coding
&lt;/h3&gt;

&lt;p&gt;This assumption could not be further from the truth. What you need is basic &lt;strong&gt;computer skills&lt;/strong&gt; like how to use your mouse, typing, and others. The truth is that it's actually when you &lt;strong&gt;start coding&lt;/strong&gt; that you'll probably learn more about what you can do with your computer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;For any myth I missed out, &lt;strong&gt;please drop it in the comments&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;My advice is to ignore these myths because they could be discouraging which is not good for your mental state. Coding is an insanely valuable skill to learn and it could change your life for the better. &lt;strong&gt;Don't hesitate to learn it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feel free to check out my socials:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/mr_codeslinger" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.instagram.com/mr_codeslinger/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;GOOD LUCK&lt;/strong&gt;  👍&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>100daysofcode</category>
      <category>womenintech</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why you should learn Git</title>
      <dc:creator>user</dc:creator>
      <pubDate>Fri, 18 Sep 2020 23:04:36 +0000</pubDate>
      <link>https://dev.to/user000001/why-you-should-learn-git-32b</link>
      <guid>https://dev.to/user000001/why-you-should-learn-git-32b</guid>
      <description>&lt;p&gt;Normally when you &lt;em&gt;google&lt;/em&gt; for things like: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tips on how to be a better programmer&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You're gonna see &lt;strong&gt;Teamwork&lt;/strong&gt;. This is where &lt;strong&gt;Git&lt;/strong&gt; comes in. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Git?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imagine you are coloring on a flower coloring book. You colored in green for all leaves and now it’s time for the best part, coloring the petal. You know you enjoy red the best but it looked horrible after you finished it. With &lt;strong&gt;Git&lt;/strong&gt;, you can revert your choice of red in a heartbeat and you are free to reapply the red if you change your mind. &lt;strong&gt;A work doesn’t have to be permanent; every action is recorded and reversible&lt;/strong&gt;. &lt;a href="https://dev.to/maestromac/comment/him"&gt;&lt;em&gt;Source&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt; is a &lt;strong&gt;Version Control System&lt;/strong&gt; (VCS). On a &lt;strong&gt;very basic level&lt;/strong&gt;, there are two awesome things a VCS allows you to do: You can &lt;strong&gt;track changes&lt;/strong&gt; in your files, and it simplifies working on files and projects with multiple people. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now lets' focus on the main question.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why should I learn Git?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  1. Git is simple and easy to learn
&lt;/h3&gt;

&lt;p&gt;I think it takes about fifteen to thirty minutes to learn Git. You could look for tutorials on &lt;a href="//youtube.com"&gt;YouTube&lt;/a&gt;. You could watch this fifteen minutes &lt;a href="https://www.youtube.com/watch?v=USjZcfj8yxE&amp;amp;t=162s" rel="noopener noreferrer"&gt;video&lt;/a&gt; and also download this &lt;a href="https://www.atlassian.com/dam/jcr:e7e22f25-bba2-4ef1-a197-53f46b6df4a5/SWTM-2088_Atlassian-Git-Cheatsheet.pdf" rel="noopener noreferrer"&gt;cheatsheet&lt;/a&gt;. Those are two very useful resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Version control
&lt;/h3&gt;

&lt;p&gt;With git whenever you get issues or bugs or you just don't know what you're doing anymore 😅 (happens to a lot of us), you could revert back to like &lt;em&gt;three-months-ago&lt;/em&gt; and reassess your strategy. &lt;strong&gt;Git&lt;/strong&gt; will remember every change. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. Teamwork
&lt;/h3&gt;

&lt;p&gt;Git simplifies the process of working with teams. Team members can work on files and merge them with the master branch. It allows multiple people to work on the same file at the same time.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. You would not forget what you wrote
&lt;/h3&gt;

&lt;p&gt;With Git you could abandon a project for like &lt;em&gt;four months&lt;/em&gt; (which you shouldn't) and later come back to it and you wouldn't be asking questions like: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Who wrote this ?!&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;because you read through &lt;strong&gt;commits&lt;/strong&gt; to help you remember what each change in the file was for.&lt;/p&gt;

&lt;p&gt;Also, I realized that a lot of Code Newbies say thing's like they'll look into Git later in their coding career. That's the wrong way of thinking. If you've already learned to code just know that it's never too late to learn Git but I actually feel like you should learn Git before you start coding. Just know that Git is not only for programmers.&lt;/p&gt;

&lt;p&gt;If this article has convinced you to learn &lt;strong&gt;Git&lt;/strong&gt;, click &lt;a href="https://gitimmersion.com/index.html" rel="noopener noreferrer"&gt;here&lt;/a&gt; to learn it. &lt;em&gt;Your Welcome&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out my&lt;/strong&gt; &lt;a href="https://twitter.com/mr_codeslinger" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.instagram.com/mr_codeslinger/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOOD LUCK&lt;/strong&gt;  👍&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>codenewbie</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Logistic Regression with Scikit-learn</title>
      <dc:creator>user</dc:creator>
      <pubDate>Fri, 18 Sep 2020 19:21:32 +0000</pubDate>
      <link>https://dev.to/user000001/logistic-regression-with-scikit-learn-37hc</link>
      <guid>https://dev.to/user000001/logistic-regression-with-scikit-learn-37hc</guid>
      <description>&lt;p&gt;We'll start with the questions on your minds right now.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Logistic Regression? &lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Logistic Regression&lt;/strong&gt; is a &lt;strong&gt;Machine Learning classification algorithm&lt;/strong&gt; that is used to &lt;strong&gt;predict the probability&lt;/strong&gt; of a categorical dependent variable. &lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;logistic regression&lt;/strong&gt;, the &lt;strong&gt;dependent variable is a binary variable&lt;/strong&gt; that contains data coded as &lt;code&gt;1&lt;/code&gt; (yes, success, etc.) or &lt;code&gt;0&lt;/code&gt; (no, failure, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/i/8ldj8p81brs3sya14kxu.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What you should &lt;strong&gt;depict&lt;/strong&gt; from this image is that in &lt;strong&gt;logistic regression&lt;/strong&gt;, your &lt;strong&gt;data&lt;/strong&gt; is &lt;strong&gt;classified&lt;/strong&gt; into &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you've been &lt;strong&gt;following up with the series&lt;/strong&gt;. Just know that this is a &lt;strong&gt;special&lt;/strong&gt; one because today you're gonna do the &lt;strong&gt;Feature Extraction&lt;/strong&gt; by yourself.&lt;/p&gt;

&lt;p&gt;The question that's probably on your mind if you've not been following up with the &lt;strong&gt;series&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Feature Extraction?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Feature extraction is a process of dimensionality reduction by which an initial set of raw data is reduced to more manageable groups for processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In other terms, it is the act of selecting useful features from a dataset and dumping the rest. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click &lt;a href="https://www.kaggle.com/ronitf/heart-disease-uci" rel="noopener noreferrer"&gt;here&lt;/a&gt; to download the dataset we're gonna be using today. Normally, once you click on the link it starts downloading but as I said this article is different. Since you're doing the &lt;strong&gt;Feature Extraction&lt;/strong&gt; &lt;strong&gt;yourself&lt;/strong&gt;, you'll have to know which &lt;strong&gt;feature's&lt;/strong&gt; you're gonna select. This means that you'll have to study the &lt;strong&gt;attribute information&lt;/strong&gt; &lt;strong&gt;yourself&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  GOAL OF THE DAY:
&lt;/h3&gt;

&lt;p&gt;We're gonna make a model that would be able to &lt;strong&gt;predict&lt;/strong&gt; if someone has &lt;strong&gt;heart disease&lt;/strong&gt; or &lt;strong&gt;doesn't&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We're gonna start &lt;strong&gt;coding&lt;/strong&gt; now&lt;/p&gt;

&lt;h3&gt;
  
  
  Importing the needed libraries
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Load and view the dataset
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df = pd.read_csv('heart.csv')
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/i/7nxqko4f0pwpalkcjt9h.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature Extraction
&lt;/h3&gt;

&lt;p&gt;This is where you do your research check which features are important.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making the training and validation set
&lt;/h3&gt;

&lt;p&gt;When a &lt;strong&gt;large amount&lt;/strong&gt; of &lt;strong&gt;data&lt;/strong&gt; is at hand, a &lt;strong&gt;set of samples&lt;/strong&gt; can be set aside to &lt;strong&gt;evaluate&lt;/strong&gt; the &lt;strong&gt;final model&lt;/strong&gt;. The &lt;strong&gt;"training"&lt;/strong&gt; data set is the general term for the samples used to &lt;strong&gt;create the model&lt;/strong&gt;, while the &lt;strong&gt;“test”&lt;/strong&gt; or &lt;strong&gt;“validation”&lt;/strong&gt; data set is used to &lt;strong&gt;qualify performance&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;train_data, validation_data, train_labels, validation_labels = train_test_split(
data,
labels,
train_size=0.8,
test_size=0.2,
random_state=1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;train_size&lt;/code&gt; is how big or small you want your &lt;strong&gt;training set&lt;/strong&gt; to be. This is the same for &lt;code&gt;test_size&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;random_state&lt;/code&gt; is basically used for reproducing your problem the same every time it is run. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Making a model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model = LogisticRegression()
model.fit(train_data,train_labels)
print(model.score(validation_data,validation_labels))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0.7704918032786885
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The score is not too bad but it's not good.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making predictions with your model
&lt;/h3&gt;

&lt;p&gt;Now it's time to make a prediction, using the features that you've picked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(model.predict([[63,1,4,141,233,1,1,150,0,2.3,0,0,1]]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can visit &lt;a href="https://www.kaggle.com/" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt; to find more datasets that you can perform &lt;strong&gt;Logistic Regression&lt;/strong&gt; on. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out my&lt;/strong&gt; &lt;a href="https://twitter.com/mr_codeslinger" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.instagram.com/mr_codeslinger/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feel free to ask questions in the comments&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOOD LUCK&lt;/strong&gt; 👍&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>K-Nearest Neighbors with Scikit-learn</title>
      <dc:creator>user</dc:creator>
      <pubDate>Fri, 18 Sep 2020 19:18:19 +0000</pubDate>
      <link>https://dev.to/user000001/k-nearest-neighbors-with-scikit-learn-31na</link>
      <guid>https://dev.to/user000001/k-nearest-neighbors-with-scikit-learn-31na</guid>
      <description>&lt;p&gt;Before we start talking about &lt;strong&gt;K-Nearest Neighbors&lt;/strong&gt;, I'm going to list other common &lt;strong&gt;classification algorithms&lt;/strong&gt; in Machine Learning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logistic regression&lt;/li&gt;
&lt;li&gt;Support Vector Machines&lt;/li&gt;
&lt;li&gt;Decision trees&lt;/li&gt;
&lt;li&gt;Random forests&lt;/li&gt;
&lt;li&gt;Naive Bayes classifier &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I'm gonna focus on the questions that are probably in your head right now.&lt;/p&gt;

&lt;p&gt;What is the &lt;strong&gt;K-Nearest Neighbors&lt;/strong&gt; algorithm?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This algorithm is used to solve the classification model problems. K-nearest neighbor or K-NN algorithm creates an imaginary boundary to classify the data. When new data points come in, the algorithm will try to predict that to the nearest of the boundary line. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It could look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cdn.hashnode.com/res/hashnode/image/upload/v1600176962181/GW7MotrfE.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From this image, you would be able to depict that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When &lt;code&gt;k=3&lt;/code&gt; the new data point(the star) introduced is going to be classified into &lt;strong&gt;Class B&lt;/strong&gt; because there are more &lt;strong&gt;Class B&lt;/strong&gt; data points in the imaginary boundary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When &lt;code&gt;k=6&lt;/code&gt; the new data point(the star) introduced is going to be classified into &lt;strong&gt;Class A&lt;/strong&gt; because there are more &lt;strong&gt;Class A&lt;/strong&gt; data points in the imaginary boundary.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we start coding you'll need to install the dataset we're gonna use. Click &lt;a href="https://www.kaggle.com/merishnasuwal/breast-cancer-prediction-dataset/download" rel="noopener noreferrer"&gt;here&lt;/a&gt; to install the dataset we're gonna use. Open the file named &lt;code&gt;Breast_cancer_data.csv&lt;/code&gt;. You should see something like this: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://cdn.hashnode.com/res/hashnode/image/upload/v1600195619729/8d8M6Pb2W.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GOAL OF THE DAY
&lt;/h3&gt;

&lt;p&gt;We're gonna make a &lt;strong&gt;classification model&lt;/strong&gt; that would be able to &lt;strong&gt;predict&lt;/strong&gt; whether a breast is cancerous or not.&lt;/p&gt;

&lt;p&gt;We're gonna start &lt;strong&gt;coding&lt;/strong&gt; now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importing the needed libraries
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Load and view the dataset
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df = pd.read_csv('Breast_cancer_data.csv')
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cdn.hashnode.com/res/hashnode/image/upload/v1600196395564/cV45Zya8h.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature Extraction
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = df[["mean_radius", "mean_texture", "mean_perimeter", "mean_area", "mean_smoothness"]]
data = data.values.reshape(-1,5)
labels = df["diagnosis"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Making a classification model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;classifier = KNeighborsClassifier(n_neighbors=100)
classifier.fit(data, labels)
print(classifier.score(data, labels))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just know that &lt;code&gt;n_neighbors&lt;/code&gt; represents &lt;code&gt;k&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0.8945518453427065
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Making predictions with your model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(classifier.predict([[7.76,24.54,47.92,181.0,0.05263]]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows that this is a cancerous breast but who knows, our &lt;strong&gt;model's prediction&lt;/strong&gt; might be &lt;strong&gt;wrong&lt;/strong&gt;. Just know that even if your model has a &lt;strong&gt;high score&lt;/strong&gt; some of its predictions might still be wrong.&lt;/p&gt;

&lt;p&gt;You can visit &lt;a href="https://www.kaggle.com/" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt; to find more datasets that you can perform &lt;strong&gt;Classification with K-Nearest Neighbors&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out my&lt;/strong&gt; &lt;a href="https://twitter.com/mr_codeslinger" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.instagram.com/mr_codeslinger/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feel free to ask questions in the comments&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOOD LUCK&lt;/strong&gt; 👍&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>Linear Regression with Scikit-learn (Part 2)</title>
      <dc:creator>user</dc:creator>
      <pubDate>Fri, 18 Sep 2020 19:15:04 +0000</pubDate>
      <link>https://dev.to/user000001/linear-regression-with-scikit-learn-part-2-4i8h</link>
      <guid>https://dev.to/user000001/linear-regression-with-scikit-learn-part-2-4i8h</guid>
      <description>&lt;p&gt;This is the &lt;strong&gt;second part&lt;/strong&gt; and here we would be talking about &lt;strong&gt;Multiple Linear Regression&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt; on all your minds:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Multiple Linear Regression?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is a &lt;strong&gt;statistical technique&lt;/strong&gt; that uses several explanatory variables to &lt;strong&gt;predict the outcome&lt;/strong&gt; of a response variable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multiple Linear Regression&lt;/strong&gt; is used to &lt;strong&gt;estimate&lt;/strong&gt; the &lt;strong&gt;relationship&lt;/strong&gt; between &lt;strong&gt;two or more independent variables and one dependent variable&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;strong&gt;Multiple Linear Regression&lt;/strong&gt;(MLR), you can &lt;strong&gt;predict&lt;/strong&gt; the &lt;strong&gt;price&lt;/strong&gt; of a car, house, and more.&lt;/p&gt;

&lt;p&gt;Before we start coding you'll need to install the dataset we're gonna use. Click &lt;a href="https://www.kaggle.com/karthickveerakumar/startup-logistic-regression/download" rel="noopener noreferrer"&gt;here&lt;/a&gt; to download the dataset we're gonna use. Open the file named &lt;code&gt;50_Startups.csv&lt;/code&gt;. You should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/i/yoq14quxw9653zu567mk.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;GOAL OF THE DAY&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We're going to make a &lt;strong&gt;regression model&lt;/strong&gt; that would be able to &lt;strong&gt;predict&lt;/strong&gt; the &lt;strong&gt;profit&lt;/strong&gt; of Startups.&lt;/p&gt;

&lt;p&gt;We're gonna start &lt;strong&gt;coding&lt;/strong&gt; now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importing the libraries
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Load and view dataset
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df = pd.read_csv('50_Startups.csv')
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/i/zgen0urjbhiwp4ww89j1.png" rel="noopener noreferrer"&gt;Image&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature Extraction
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Feature Extraction?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Feature extraction is a process of dimensionality reduction by which an initial set of raw data is reduced to more manageable groups for processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In other terms, it is the act of selecting useful features from a dataset and dumping the rest.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = df[['R&amp;amp;D Spend', 'Administration', 'Marketing Spend']]
data = data.values.reshape(-1,3)
labels = df[['Profit']]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, I did not select the &lt;code&gt;State&lt;/code&gt; column to be part of the data. The reason being that it is not really necessary, and any &lt;strong&gt;unnecessary data&lt;/strong&gt; would decrease the chances of your &lt;strong&gt;model accuracy&lt;/strong&gt; being &lt;strong&gt;high&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making a Regression Model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model = LinearRegression()
model.fit(data,labels)
print(model.score(data,labels))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;code&gt;0.9507459940683246&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TAKE NOTE&lt;/strong&gt;: The closer the accuracy is to &lt;code&gt;1.0&lt;/code&gt; the better it is. It increases the chances of your model's prediction being true.&lt;/p&gt;
&lt;h3&gt;
  
  
  Making predictions with your model
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(model.predict([[165349.20, 136897.80, 471784.10]]))
print(model.predict([[144372.41, 118671.85, 383199.62]]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[[192521.25289008]]
[[173696.70002553]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's how simple it is. What you've done now is that you've predicted the profit of a Startup from some of their expenses.&lt;/p&gt;

&lt;p&gt;You can visit &lt;a href="https://www.kaggle.com/" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt; to find more datasets that you can perform Linear Regression on. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out my&lt;/strong&gt; &lt;a href="https://twitter.com/mr_codeslinger" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.instagram.com/mr_codeslinger/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feel free to ask questions in the comments&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOOD LUCK&lt;/strong&gt; 👍&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>Linear Regression with Scikit-learn (Part 1)</title>
      <dc:creator>user</dc:creator>
      <pubDate>Mon, 14 Sep 2020 10:55:47 +0000</pubDate>
      <link>https://dev.to/user000001/linear-regression-with-scikit-learn-part-1-2ep9</link>
      <guid>https://dev.to/user000001/linear-regression-with-scikit-learn-part-1-2ep9</guid>
      <description>&lt;p&gt;First off let's start with the questions on your mind:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Scikit-learn?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Scikit-learn&lt;/strong&gt; is a &lt;strong&gt;Python&lt;/strong&gt; framework for &lt;strong&gt;machine learning&lt;/strong&gt;. It features various algorithms like &lt;strong&gt;support vector machines&lt;/strong&gt;, &lt;strong&gt;random forests&lt;/strong&gt;, and &lt;strong&gt;k-neighbors&lt;/strong&gt;, which you are going to learn here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is Linear Regression?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A &lt;strong&gt;statistical way&lt;/strong&gt; of measuring the relationship between &lt;strong&gt;variables&lt;/strong&gt;. Just know that with &lt;strong&gt;Linear Regression&lt;/strong&gt;, you can predict the future.&lt;/p&gt;

&lt;p&gt;There are two types of &lt;strong&gt;Linear Regression&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;Simple&lt;/strong&gt; Linear Regression&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Multiple&lt;/strong&gt; Linear Regression&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just know that &lt;strong&gt;Multiple Linear Regression&lt;/strong&gt; is an extension of &lt;strong&gt;Simple Linear Regression&lt;/strong&gt;. It is used when we want to predict the value of a variable based on the value of two or more other variables. &lt;/p&gt;

&lt;p&gt;That's enough information for now. We're gonna start coding.&lt;/p&gt;

&lt;p&gt;This first article is for &lt;strong&gt;Simple Linear Regression&lt;/strong&gt; the second part is for &lt;strong&gt;Multiple Linear Regression&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We have to install the following libraries using &lt;code&gt;pip&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pandas
pip install numpy
pip install sklearn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click &lt;a href="https://bit.ly/2RneQBY" rel="noopener noreferrer"&gt;here&lt;/a&gt; to install the dataset we're gonna use. Then extract the &lt;code&gt;Salary_Data.csv&lt;/code&gt; file inside it.&lt;/p&gt;

&lt;p&gt;You should see a &lt;code&gt;.csv&lt;/code&gt; file like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   YearsExperience   Salary
0              1.1  39343.0
1              1.3  46205.0
2              1.5  37731.0
3              2.0  43525.0
4              2.2  39891.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The data explanation&lt;/strong&gt;:&lt;br&gt;
As you can see there is a &lt;strong&gt;column&lt;/strong&gt; called &lt;code&gt;YearsExperience&lt;/code&gt;. This is the feature. In &lt;strong&gt;ML&lt;/strong&gt; a &lt;strong&gt;feature&lt;/strong&gt; is an individual measurable property or characteristic of a phenomenon being observed.&lt;br&gt;
&lt;strong&gt;Also&lt;/strong&gt;&lt;br&gt;
there is a &lt;strong&gt;column&lt;/strong&gt; called &lt;code&gt;Salary&lt;/code&gt;. This is the &lt;strong&gt;Label&lt;/strong&gt;. In &lt;strong&gt;ML&lt;/strong&gt; a &lt;strong&gt;label&lt;/strong&gt; is the thing we're &lt;strong&gt;predicting&lt;/strong&gt;. It's the &lt;code&gt;y&lt;/code&gt; &lt;strong&gt;variable&lt;/strong&gt; in &lt;strong&gt;Simple Linear Regression&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Open your Code Editor and make a new &lt;strong&gt;Python&lt;/strong&gt; file called: &lt;code&gt;linear_regression.py&lt;/code&gt; or you could open a &lt;strong&gt;Jupyter Notebook&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Importing the needed libraries
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We use the &lt;code&gt;as&lt;/code&gt; keyword to give the imported module an alias to make our code shorter.&lt;/p&gt;
&lt;h3&gt;
  
  
  Load and view dataset
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df = pd.read_csv('Salary_Data.csv')
print(df.head())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   YearsExperience   Salary
0              1.1  39343.0
1              1.3  46205.0
2              1.5  37731.0
3              2.0  43525.0
4              2.2  39891.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Feature Extraction
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = df['YearsExperience']
x = x.values.reshape(-1, 1)
y = df['Salary']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Making a regression  model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model = LinearRegression()
model.fit(x,y)
print(model.score(x,y))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just know that the &lt;strong&gt;last line&lt;/strong&gt; &lt;code&gt;print(model.score(x,y))&lt;/code&gt; is done to check how accurate your model is.&lt;br&gt;
Below is the output of the &lt;code&gt;print()&lt;/code&gt; statement above. The &lt;code&gt;.score()&lt;/code&gt; function is used to get the accuracy of your model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0.9569566641435086
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The closer it is to &lt;code&gt;1&lt;/code&gt; the more accurate it is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making predictions with your model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(model.predict([[3]]))
print(model.predict([[4]]))
print(model.predict([[5]]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[54142.08716303]
[63592.04948449]
[73042.01180594]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's how simple it is. What you've done now is that you've &lt;strong&gt;predicted&lt;/strong&gt; the &lt;strong&gt;salary&lt;/strong&gt; of a person from their &lt;strong&gt;years of experience&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;You can visit &lt;a href="https://www.kaggle.com/" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt; to find more datasets that you can perform Linear Regression on. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feel free to ask questions&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;GOOD LUCK&lt;/strong&gt; 👍&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
