<?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: Michael Learns</title>
    <description>The latest articles on DEV Community by Michael Learns (@imronlearning).</description>
    <link>https://dev.to/imronlearning</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%2F47555%2F92f5330f-7216-4d94-a8a5-a3d8b63cf388.png</url>
      <title>DEV Community: Michael Learns</title>
      <link>https://dev.to/imronlearning</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imronlearning"/>
    <language>en</language>
    <item>
      <title>What Would You Use When Starting a New Company/Project?</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Mon, 16 Mar 2020 09:04:08 +0000</pubDate>
      <link>https://dev.to/imronlearning/what-would-you-use-when-starting-a-new-company-project-1oi7</link>
      <guid>https://dev.to/imronlearning/what-would-you-use-when-starting-a-new-company-project-1oi7</guid>
      <description>&lt;p&gt;Hello everyone! I want to start a discussion about technologies that you would use if you're starting a new project or building up a new tech company.&lt;/p&gt;

&lt;p&gt;If you're starting a new tech company what languages, technologies, platforms, etc. would you use and why? Say your tech company is doing some  web and app development and you're developing to setup a new e-commerce site or a social networking site.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>question</category>
    </item>
    <item>
      <title>Hey, it's been awhile</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Thu, 20 Feb 2020 11:03:45 +0000</pubDate>
      <link>https://dev.to/imronlearning/hey-it-s-been-awhile-1o0d</link>
      <guid>https://dev.to/imronlearning/hey-it-s-been-awhile-1o0d</guid>
      <description>&lt;p&gt;Hey everyone! It's been awhile since I last posted here. But I'm back! Hooray! 🎉🎉🎉&lt;/p&gt;

&lt;p&gt;I've been busy with quite a few things lately. But lately I've been itching to get back into some coding. I want to stretch my mind a bit and refresh my hands to get used to coding again.&lt;/p&gt;

&lt;p&gt;So here I am! I wanted to ask for some ideas from you guys of what you might want me to code! Here are 2 things that I do know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Django&lt;/li&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it. Pretty limited I guess. But I'm willing to learn new things! So shoot 'em at me and I'll give it a shot! 😄✨&lt;/p&gt;

</description>
      <category>project</category>
      <category>ideas</category>
      <category>inspiration</category>
    </item>
    <item>
      <title>Most Memorable Moment in Your Job</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 23 Feb 2019 15:07:12 +0000</pubDate>
      <link>https://dev.to/imronlearning/most-memorable-moment-in-your-job-1885</link>
      <guid>https://dev.to/imronlearning/most-memorable-moment-in-your-job-1885</guid>
      <description>&lt;p&gt;Let's walk down through memory lane and remember our most memorable moment in our jobs. Good or bad, we have learned and grown, we  laughed and cried. &lt;/p&gt;

&lt;h1&gt;
  
  
  My Most Memorable Moment
&lt;/h1&gt;

&lt;p&gt;My most memorable moment would be that time when I wrote a code for a function that I knew I would need in the future. I left that project after a while and was assigned to another one.&lt;/p&gt;

&lt;p&gt;The code was like a function that did some cleaning on the data queried from a database. It was pretty complex &lt;em&gt;(not the best well-written code)&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;A few months later, I was brought back into the project to continue my unfinished tasks. I later encountered a problem that was quite complex. Reading my code from a few months back &lt;em&gt;(with no proper documentation!! how dare me to myself?? 😭)&lt;/em&gt; I was already lost. &lt;/p&gt;

&lt;p&gt;Luckily, that function that I knew I would need was documented. I had forgotten I had written a code for myself in the future, and when I read the short doc about the function, I then recalled that it was the very solution I needed for my problem. I laughed so hard &lt;em&gt;(internally ofc 😅)&lt;/em&gt; because past self predicted how well my future self would forget and need the very same solution. &lt;/p&gt;

&lt;p&gt;So the lesson is, always right proper documentation and write clean and readable code. 🤔&lt;/p&gt;

&lt;p&gt;What's yours? Can't wait to hear them!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>random</category>
    </item>
    <item>
      <title>Flask vs. Django?</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 16 Feb 2019 15:11:43 +0000</pubDate>
      <link>https://dev.to/imronlearning/flask-vs-django-1l4k</link>
      <guid>https://dev.to/imronlearning/flask-vs-django-1l4k</guid>
      <description>&lt;p&gt;So I was going to do a Flask tutorial this week after learning it &lt;em&gt;in a week&lt;/em&gt;, but I decided to do a comparison with Flask and Django since I've had hands-on-experience with both python web frameworks. The reason is so that I can help you choose which framework to learn as learning a framework can be very time consuming —- but very fun of course! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CAUTION: I only spent a week with Flask whereas I've used Django for the past 3 years. Take this with a grain of salt 😅&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Similarities
&lt;/h2&gt;

&lt;p&gt;Let's start with similarities.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Flask and Django are both &lt;strong&gt;python web frameworks&lt;/strong&gt;.
&lt;/h3&gt;

&lt;p&gt;They enable you to create web applications using python for backend logic and html and css as front, or whatever front-end framework you'd prefer. &lt;/p&gt;

&lt;h3&gt;
  
  
  2) &lt;strong&gt;Can use ORM or object-relational-mapping.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This  basically means, you can use SQLITE, MYSQL, PostgreSQL, and other databases that utilizes ORM.&lt;/p&gt;

&lt;p&gt;-&lt;strong&gt;Django&lt;/strong&gt; by default uses ORM. &lt;br&gt;
-&lt;strong&gt;Flask&lt;/strong&gt; does not come with ORM capabilities by default. You need to manually add it if you want.&lt;/p&gt;
&lt;h3&gt;
  
  
  3) &lt;strong&gt;Templating&lt;/strong&gt;.
&lt;/h3&gt;

&lt;p&gt;-&lt;strong&gt;Django&lt;/strong&gt; uses a template engine similar to Jinja (actually Jinja was inspired by Django's own templating system) &lt;/p&gt;


&lt;div class="liquid-comment"&gt;
    &lt;div class="details"&gt;
      &lt;a href="/djmoch"&gt;
        &lt;img class="profile-pic" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1qXKapgb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--xsyWzqQq--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_50%2Cq_auto%2Cw_50/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/132105/407a3d24-b5e3-4403-a36e-6363f126bece.jpg" alt="djmoch profile image"&gt;
      &lt;/a&gt;
      &lt;a href="/djmoch"&gt;
        &lt;span class="comment-username"&gt;Daniel Moch&lt;/span&gt;
      &lt;/a&gt;
      &lt;span class="color-base-30 px-2 m:pl-0"&gt;•&lt;/span&gt;

&lt;a href="https://dev.to/djmoch/comment/8nkf" class="comment-date crayons-link crayons-link--secondary fs-s"&gt;
  &lt;time&gt;
    Feb 16 '19
  &lt;/time&gt;

&lt;/a&gt;

    &lt;/div&gt;
    &lt;div class="body"&gt;
      

&lt;p&gt;Small comment: Django doesn’t use Jinja, but it’s own templating engine. They look similar because, as Jinja’s website says, “It is inspired by Django's templating system.”&lt;/p&gt;



    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;-&lt;strong&gt;Flask&lt;/strong&gt; uses Jinja as its template engine.&lt;/p&gt;

&lt;p&gt;Jinja is basically like python for html (python + html = Jinja) that enables you to add logic to your html such us if/else, for-loops, and extension of templates which I really really love! &lt;/p&gt;

&lt;p&gt;There are many more similarities between Flask and Django, but for me those are three the main ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Differences
&lt;/h2&gt;

&lt;p&gt;The differences are quite big when you put Flask and Django side by side. &lt;/p&gt;

&lt;h3&gt;
  
  
  With Flask you get &lt;strong&gt;incredible flexibility&lt;/strong&gt;.
&lt;/h3&gt;

&lt;p&gt;You create the app.py (which is like the main logic for your app), the models.py (which is where you store your models that creates the tables for your database), the templating and etc. &lt;strong&gt;You have ABSOLUTE control on how you want to build the structure for you app.&lt;/strong&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  With Django, &lt;strong&gt;it's all built for you!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The settings.py (which is like the config file for your app) the models.py, the urls.py (which is where all the routings are stored), the templating, etc.&lt;/p&gt;

&lt;p&gt;Which is why Django's tag is, "&lt;strong&gt;The web framework for perfectionist with a deadline.&lt;/strong&gt;" Because everything is built in, you don't need to bother yourself with creating the files and thinking about how you should structure your app. &lt;strong&gt;It's all ready for you&lt;/strong&gt; and &lt;strong&gt;you can immediately get started with building your app&lt;/strong&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Flask and Django both have their strengths and weaknesses. &lt;br&gt;
Each one has their own uses and purposes.&lt;/p&gt;

&lt;p&gt;If you're making an app that's simple that doesn't anything too complex, then Flask is the way to go. &lt;/p&gt;

&lt;p&gt;But if you're a &lt;strong&gt;beginner&lt;/strong&gt; and want to get into web development with python, I'd suggest you &lt;strong&gt;start with Flask&lt;/strong&gt;. The things you learn in Flask can be applied to Django. It's just easier with Flask.&lt;/p&gt;

&lt;p&gt;Congratulations 🎉🎉! You made it! I hoped it helped you out!&lt;br&gt;
Also, tell me if you'd like to see me do &lt;br&gt;
a tutorial of Flask or Django on Youtube.&lt;br&gt;
Thanks ya'll! Have a break, take a kitkat 🍫.&lt;/p&gt;

&lt;p&gt;Thanks for all those who gave their feedback and added stuff to my knowledge on Flask and Django! Keep 'em coming ✌🏽&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Follow me on &lt;a href="https://twitter.com/heyimprax"&gt;Twitter&lt;/a&gt; and &lt;a href="https://www.instagram.com/heyimprax/?hl=en"&gt;Instagram&lt;/a&gt; @heyimprax.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Subscribe to my channel in &lt;a href="https://www.youtube.com/channel/UCZi44WflNC257aYE317PbLg"&gt;Coding Prax&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>web</category>
      <category>python</category>
      <category>framework</category>
      <category>comparison</category>
    </item>
    <item>
      <title>Explain What is DOM like I'm 🖐</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 09 Feb 2019 15:58:52 +0000</pubDate>
      <link>https://dev.to/imronlearning/explain-what-is-dom-like-im--450i</link>
      <guid>https://dev.to/imronlearning/explain-what-is-dom-like-im--450i</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.slideplayer.com%2F31%2F9631242%2Fslides%2Fslide_3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.slideplayer.com%2F31%2F9631242%2Fslides%2Fslide_3.jpg" title="DOM" alt=" DOM "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hopefully I can explain this easily and accurately 😅&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've been puzzled as to what &lt;strong&gt;DOM&lt;/strong&gt; meant. I've seen &lt;strong&gt;DOM&lt;/strong&gt; being used especially in Polymer and ReactJS documentations.&lt;/p&gt;

&lt;p&gt;DOM means, &lt;strong&gt;"Document Object Model"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Basically, a web page is an html document. This &lt;em&gt;document&lt;/em&gt; is actually an &lt;strong&gt;object&lt;/strong&gt;. Under this object we have our element tags like the &lt;strong&gt;body&lt;/strong&gt;, &lt;strong&gt;h1&lt;/strong&gt;, &lt;strong&gt;div&lt;/strong&gt;, etc. All these elements in a page have some sort of object structure. &lt;/p&gt;

&lt;p&gt;Something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;document&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;head&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;head&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;style&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;backgroundColor&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;black&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; 
               &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my html file it would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the elements of the DOM is an object model (or structure). Meaning that an  element like &lt;strong&gt;h1&lt;/strong&gt; would have a object structure like in the sample above. Yeah! Insane right? You can access these  properties just like you would when accessing an object with Javascript!&lt;/p&gt;

&lt;p&gt;Let's have an example. &lt;br&gt;
I have a html element here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt; Hello World &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using javascript I can actually change the properties of h1 by accessing it's object model like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// say we want to change it's background color to blue&lt;/span&gt;
&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;backgroundColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this works! Why? &lt;strong&gt;h1&lt;/strong&gt; actually has an object or property called &lt;strong&gt;style&lt;/strong&gt; and under &lt;strong&gt;style&lt;/strong&gt; it has a property called &lt;strong&gt;backgroundColor&lt;/strong&gt; (or background-color in css) which allows us to modify that &lt;strong&gt;backgroundColor&lt;/strong&gt; of &lt;strong&gt;h1&lt;/strong&gt;! Cool!&lt;/p&gt;

&lt;p&gt;Notice I did &lt;strong&gt;'document.'&lt;/strong&gt;, right? This means that the HTML document is parsed into an object model which is the &lt;strong&gt;'document'&lt;/strong&gt; object and all the elements that are in the DOM are all found under this document object. &lt;/p&gt;

&lt;p&gt;There are different ways in accessing the DOM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//gets all elements that are h1&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementsByTagName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//similar to query selector except that it takes the tags of the element&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;navHeader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nav-header&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//gets elements by its id &lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;btn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementsByClassName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//gets elements by its class &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you go! I hope I was able to  briefly and easily explain what DOM is. &lt;br&gt;
Please do let me know if I missed anything.&lt;/p&gt;

&lt;p&gt;Congratulations you made it! 🎉 Have a break and have a kitkat 🍫&lt;br&gt;
Cheers ya'll! Follow me on Twitter and Instagram on @heyimprax. &lt;/p&gt;

</description>
      <category>web</category>
      <category>dom</category>
      <category>explain</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Aim for Perfection, Don't Expect a Bullseye</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 02 Feb 2019 15:35:05 +0000</pubDate>
      <link>https://dev.to/imronlearning/aim-for-perfection-dont-expect-a-bullseye-56hk</link>
      <guid>https://dev.to/imronlearning/aim-for-perfection-dont-expect-a-bullseye-56hk</guid>
      <description>&lt;p&gt;I’m a planned out sort of guy. I love it when things are perfect. My stuff are organised like a library. All my stuff is strategically placed. Even the files in my laptop. I hate clutter and chaos.&lt;/p&gt;

&lt;p&gt;In all my projects I want it to be the very best. I feel like if I'm giving it my all, if I’m not giving enough, and if it’s not the best then never mind. When it came to group projects, when my group mates can’t follow what I said to the T then in the next time around I’d rather do it myself. I became this person who would rather do things on his own and make it exactly as he had in mind rather than to work with people that would have a higher risk of making the idea imperfect. It became lonely. I was incredibly stressed. I aimed for my expectations only to fail at it time and time again.&lt;/p&gt;

&lt;p&gt;I started reevaluating my point of view on perfectionism. I took a closer look at how this world works around perfectionism. Then it hit me. &lt;strong&gt;NOTHING IS PERFECT&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So I had to change my mind. I still wanted things to be the best they could be. I wanted my projects to be done in excellence. I wanted myself to be excellent. But how?&lt;/p&gt;

&lt;p&gt;Four things I learned:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Strive for perfection, but don’t expect the results to be perfect.&lt;/li&gt;
&lt;li&gt;Things will never be perfect, live with it.&lt;/li&gt;
&lt;li&gt;Imperfection makes you grow.&lt;/li&gt;
&lt;li&gt;Aiming for perfection forces you to be even better than before.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So aim for perfection, but don’t expect to hit that bullseye.&lt;/p&gt;

&lt;p&gt;What are your thoughts on perfection?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>perfection</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Monkey Recognition with Tensorflow Keras</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 26 Jan 2019 15:28:15 +0000</pubDate>
      <link>https://dev.to/imronlearning/monkey-recognition-with-tensorflow-keras-4bcp</link>
      <guid>https://dev.to/imronlearning/monkey-recognition-with-tensorflow-keras-4bcp</guid>
      <description>&lt;p&gt;It’s amazing how easy machine learning has become. It’s no longer a hinderance if you don’t have any mathematical background knowledge or any academia background on machine learning. I certainly belong to the category.&lt;/p&gt;

&lt;p&gt;One of my goals in using machine learning is when recognising something. I wanted to build a model that could do facial recognition, identify animal species, name of things, etc. Learning the math to this was horrendous and quite difficult for someone with  little knowledge on math. I almost gave up on this seemingly unattainable goal until I discovered &lt;strong&gt;“pre-trained models”&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pre-trained models&lt;/strong&gt; are basically &lt;em&gt;(based on my understanding)&lt;/em&gt;, models that have been trained on different datasets to solve a similar problem. There are different kinds of pre-trained models, each one for their own specific purposes for different problems. &lt;/p&gt;

&lt;p&gt;Today, I’ll be showing you how I built a monkey recognition model using the pre-trained model &lt;strong&gt;ResNet50&lt;/strong&gt;. &lt;strong&gt;ResNet50&lt;/strong&gt; is great for specifying species &lt;em&gt;(based on what I’ve seen)&lt;/em&gt;. I’ve seen this being used for dogs as well. Sooo let’s go with monkeys 🙈&lt;/p&gt;

&lt;h1&gt;
  
  
  Setup
&lt;/h1&gt;

&lt;p&gt;I'm doing this project in a jupyter notebook. You can check my &lt;a href="https://dev.to/benprax/setup-for-machine-learning-part-3-1c02"&gt;setup&lt;/a&gt; post if you haven't yet setup your machine for machine learning. I'm using the &lt;a href="https://www.kaggle.com/slothkong/10-monkey-species" rel="noopener noreferrer"&gt;10-monkey-species&lt;/a&gt; from Kaggle.&lt;/p&gt;

&lt;p&gt;We must also have a JSON file with all the indexes of the species. You can download it in this &lt;a href="https://gist.github.com/bennyprax/65818b886ee7ad14230f96c727bce07b" rel="noopener noreferrer"&gt;Github gist&lt;/a&gt;. It's gonna be important for later.&lt;/p&gt;

&lt;p&gt;Lastly, download the pre-trained models of ResNet50. Here's a &lt;a href="https://www.kaggle.com/keras/resnet50" rel="noopener noreferrer"&gt;link&lt;/a&gt; from Kaggle. &lt;/p&gt;

&lt;h1&gt;
  
  
  Structuring our Data Directory
&lt;/h1&gt;

&lt;p&gt;My directory folder looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flt8n06nkp3f1i16jdt2r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flt8n06nkp3f1i16jdt2r.png" title="Directory Structure" alt="Directory Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have images for training and validation. *remember data splitting&lt;br&gt;
Inside the training/validation folder we have the directories for each species and their images. &lt;/p&gt;
&lt;h1&gt;
  
  
  Transforming the Images
&lt;/h1&gt;

&lt;p&gt;First hurdle is taking the images and changing it into something that our machine learning model can understand.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.preprocessing.image&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ImageDataGenerator&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.applications.resnet50&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;preprocess_input&lt;/span&gt;

&lt;span class="n"&gt;image_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;224&lt;/span&gt;
&lt;span class="n"&gt;data_generator_with_aug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ImageDataGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preprocessing_function&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;preprocess_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                                             &lt;span class="n"&gt;horizontal_flip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                             &lt;span class="n"&gt;width_shift_range&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                             &lt;span class="n"&gt;height_shift_range&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;train_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;10-monkey-species/training&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;train_generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data_generator_with_aug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flow_from_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                                                     &lt;span class="n"&gt;target_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
                                                     &lt;span class="n"&gt;batch_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                                     &lt;span class="n"&gt;class_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;categorical&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;data_generator_with_no_aug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ImageDataGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preprocessing_function&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;preprocess_input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;validation_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;10-monkey-species/validation&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;validation_generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data_generator_with_no_aug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flow_from_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;validation_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                                          &lt;span class="n"&gt;target_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                                                          &lt;span class="n"&gt;batch_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                                          &lt;span class="n"&gt;class_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;categorical&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s break this down. &lt;code&gt;ImageDataGenerator&lt;/code&gt; is a function that takes the image and preprocess the image and spits out data that the model can understand. The  &lt;code&gt;preprocessing_function&lt;/code&gt; argument takes in another function, in this case the &lt;code&gt;preprocess_input&lt;/code&gt; from ResNet50 which translates the image that RestNet50 can understand. The other arguments allows for data augmentation.&lt;/p&gt;

&lt;p&gt;Data augmentation basically allows you to augment your data. Meaning that it allows you to increase your data samples without actually increasing the number of data you have. In this example flipping the image or slightly changing the width and height of the image allows us to have more samples of the image without actually using the same exact image. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;flow_from_directory&lt;/code&gt; takes in all the images you’ve placed in the directory. &lt;/p&gt;

&lt;h1&gt;
  
  
  Building Our Model
&lt;/h1&gt;

&lt;p&gt;Now, let’s build our model!!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.applications&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ResNet50&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Sequential&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.layers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Dense&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Flatten&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Conv2D&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Dropout&lt;/span&gt;

&lt;span class="n"&gt;resnet_weights_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResNet50&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;include_top&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pooling&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;avg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;resnet_weights_path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;num_classes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Dense&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num_classes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;softmax&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;# Say not to train first layer (ResNet) model. It is already trained
&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;trainable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;optimizer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sgd&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;loss&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;categorical_crossentropy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_generator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_generator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;steps_per_epoch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;epochs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;validation_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;validation_generator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;validation_steps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Break down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So we used a Sequential convolutional network. Then we added a ResNet50 layer with the pre-trained weights. &lt;/li&gt;
&lt;li&gt;Then we added a Dense layer with the number of classes we have which is 10. Number of classes means the number of species &lt;em&gt;(in this case)&lt;/em&gt; that we're trying to identify.&lt;/li&gt;
&lt;li&gt;We also said that for the first layer of our model we don’t want to re-train it. &lt;/li&gt;
&lt;li&gt;Then we compiled everything that we did with &lt;code&gt;model.compile()&lt;/code&gt; and finally fitted everything in the &lt;code&gt;model.fit_generator()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember the generators we’ve made when we transformed our images? We placed them all in here. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Epochs is basically the number of times the model will cycle through the images. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;steps_per_epoch&lt;/code&gt; is the number of images we would take in for each epoch.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Testing Our Model
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;os.path&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;join&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.python.keras.preprocessing.image&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_img&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_to_array&lt;/span&gt;

&lt;span class="n"&gt;image_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;10-monkey-species/validation&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;img_paths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; 
               &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;n0/n000.jpg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;n5/n502.jpg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;n9/n9031.jpg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;n2/n2014.jpg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;

&lt;span class="n"&gt;image_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;224&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_prep_images&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;image_size&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;imgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;load_img&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_width&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;img_path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;img_array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nf"&gt;img_to_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;imgs&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;preprocess_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;


&lt;span class="n"&gt;test_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;read_prep_images&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we take in several test images from our validation dataset and changing them into a &lt;code&gt;np.array&lt;/code&gt; using the &lt;code&gt;read_prep&lt;/code&gt; function. &lt;/p&gt;

&lt;p&gt;Then we predict them with our model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;preds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Translating Our Predictions
&lt;/h1&gt;

&lt;p&gt;We need to translate our predictions into indexes so that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;we can use that index on our JSON file &lt;/li&gt;
&lt;li&gt;Return the appropriate data for that index&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I copied this from Kaggle with a few slight adjustments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;IPython.display&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;display&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decode_predictions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;class_list_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;`decode_predictions` expects &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
                     &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;a batch of predictions &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
                     &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;(i.e. a 2D array of shape (samples, 1000)). &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
                     &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Found array with shape: &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="n"&gt;index_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;class_list_path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pred&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;top_indices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pred&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;argsort&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:][::&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;tuple&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pred&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;top_indices&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;


&lt;span class="n"&gt;most_likely_labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decode_predictions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;class_list_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;10-monkey-species/class_monkey_species.json&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most_likely_labels&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the  &lt;code&gt;decode_predictions&lt;/code&gt; process takes in the &lt;code&gt;preds&lt;/code&gt; which is a 2D array and indexes the corresponding object from the json file. So for example if preds was [0, 1, 8] then it would index that from the json and return [[‘index_0’, ‘folder_name’], ['index_1', 'folder_name'], ['index_8', 'folder_name']].&lt;/p&gt;

&lt;p&gt;The for loop basically takes in the images and displays them with the decoded predictions. &lt;/p&gt;

&lt;p&gt;And this is the result:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhwhmekqp6w7i0ieu4c2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhwhmekqp6w7i0ieu4c2z.png" title="Model Prediction Result" alt="result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Machine Learning has become incredibly simple. It’s flabbergasting. Certain terms here like ‘softmax’ and ‘relu’ are all mathematical terms which you don’t really need to dive into their mechanics but would be useful if you had a general idea of what they do and what they’re for.  In my journey so far in machine learning, you only need a general understanding and concept of it to really begin.&lt;/p&gt;

&lt;p&gt;Hope you learned something from this! &lt;br&gt;
Would love to hear your feedback 😄 &lt;br&gt;
See more from me on twitter and instagram @heyimprax.&lt;/p&gt;

&lt;p&gt;Thanks for reading! You've made it 🎉 Have a coffee break ☕️&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>tensorflow</category>
      <category>keras</category>
    </item>
    <item>
      <title>What to do when ideas aren't flowing? </title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 19 Jan 2019 01:36:27 +0000</pubDate>
      <link>https://dev.to/imronlearning/how-to-unblock-creativity-block-338j</link>
      <guid>https://dev.to/imronlearning/how-to-unblock-creativity-block-338j</guid>
      <description>&lt;p&gt;It's never easy when we face a creativity block. Depending on what you're interested or what you're working on whether it's writing articles, coding, making videos, etc. it's never easy to make something when you simply have no idea what to make. We try to do different things just to let the creativity flowing but sometimes it just never 'clicks' and we end up frustrated on ourselves. &lt;/p&gt;

&lt;p&gt;As creators (programmers are creators) we love making things happen. We love to make things with our own hands and see it with our eyes and have it shared to others. And one of the best parts of being a creator is seeing people enjoy the product you've made, or even you enjoying the product you've made for yourself! &lt;/p&gt;

&lt;p&gt;So I wanted to open up this discussion so that can share those times you faced creativity block and what you did to get yourself out of that situation and allow the creativity to flow again.&lt;/p&gt;

&lt;p&gt;Let's write...✏️✏️✏️&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>productivity</category>
      <category>creativity</category>
    </item>
    <item>
      <title>Building our First Machine Learning Model (Pt. 4)</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 12 Jan 2019 05:25:22 +0000</pubDate>
      <link>https://dev.to/benprax/building-our-first-machine-learning-model-5dig</link>
      <guid>https://dev.to/benprax/building-our-first-machine-learning-model-5dig</guid>
      <description>

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--627q-fxa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mpoilk4uvr418ny1v16w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--627q-fxa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mpoilk4uvr418ny1v16w.png" alt="header"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post I’ll be showing you a quick and easy example applying machine learning to a dataset and doing predictions with our model.&lt;/p&gt;

&lt;p&gt;We’ll be using: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Pandas, which is helps us in data structure and data analysis or visualisation&lt;/li&gt;
&lt;li&gt;Scikit-Learn, and &lt;/li&gt;
&lt;li&gt;Iris Dataset.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I won’t be diving too deep on how to use these tools. But for what I’ll cover in this post should be enough to get you through most datasets.&lt;/p&gt;

&lt;p&gt;Let’s begin!&lt;/p&gt;

&lt;h1&gt;
  
  
  Get the Data
&lt;/h1&gt;

&lt;p&gt;First let’s download the iris dataset. You can download the iris dataset &lt;a href="https://gist.github.com/curran/a08a1080b88344b0c8a7"&gt;here&lt;/a&gt; and save it as CSV.&lt;/p&gt;

&lt;p&gt;Let’s import pandas and read our csv file.:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="n"&gt;dataset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"./iris.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# let’s see a sample of our data
&lt;/span&gt;&lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.head()&lt;/code&gt; functions shows us the top few rows in our dataset. &lt;br&gt;
You can see the columns and the rows which contain our data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--627q-fxa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mpoilk4uvr418ny1v16w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--627q-fxa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mpoilk4uvr418ny1v16w.png" alt=".head() result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at our dataset we could see the columns which are &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sepal_length"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sepal_width"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"petal_length"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"petal_width"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"species"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We want to make our &lt;strong&gt;target&lt;/strong&gt; (the thing we’re trying to predict, also called &lt;strong&gt;y&lt;/strong&gt;) to be the &lt;code&gt;species&lt;/code&gt; column and the rest of the columns &lt;code&gt;[sepal_length, sepal_width, petal_length, petal_width]&lt;/code&gt; to be our &lt;strong&gt;features&lt;/strong&gt; (also called &lt;strong&gt;X&lt;/strong&gt;). &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"species"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;features&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"sepal_length"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"sepal_width"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"petal_length"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"petal_width"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;X&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;






&lt;h1&gt;
  
  
  Splitting the Data
&lt;/h1&gt;

&lt;p&gt;Next, we need to &lt;strong&gt;split our data&lt;/strong&gt;. Typically we’d need to split our data into 3 parts. One for &lt;strong&gt;training&lt;/strong&gt;, second for &lt;strong&gt;validation&lt;/strong&gt;, and third for &lt;strong&gt;testing&lt;/strong&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Training data for training our model&lt;/li&gt;
&lt;li&gt;Validation data to validate our model and &lt;/li&gt;
&lt;li&gt;Test data to test our model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We need a validation dataset because the lifecycle of our training data wears off in every training. Essentially our model gets too familiar with our training dataset that it might form biases and affects the performance of our model to new, unseen data. Validation data makes sure that our model performs well on even unseen data. &lt;/p&gt;

&lt;p&gt;Testing dataset is when we want to see the ‘final’ performance of our model after testing with our validation data. Nothing is &lt;strong&gt;"final"&lt;/strong&gt; though. Machine Learning is a continuous improvement, but just so we can make sure our model still performs well even on unseen data, which is our testing data.&lt;/p&gt;

&lt;p&gt;Scikit-Learn uses the &lt;code&gt;train_test_split&lt;/code&gt; function which splits our data to training and validation*.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**I'm not currently sure if it can also split for test 😅✌🏽but this is enough for our small project.&lt;/em&gt;*&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;train_test_split&lt;/span&gt;

&lt;span class="c1"&gt;#splitting our dataset for training and validation
#random_state to shuffle our data
&lt;/span&gt;&lt;span class="n"&gt;train_X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;val_X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;train_y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;val_y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;train_test_split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;






&lt;h1&gt;
  
  
  Transforming the Data
&lt;/h1&gt;

&lt;p&gt;Excellent! However, machine learning doesn’t understand letters. Machine Learning is composed of a bunch of mathematical formulas and operations under the hood. In math we don’t say, One+One=Two. It must be 1+1=2. &lt;/p&gt;

&lt;p&gt;Our &lt;strong&gt;y (target variable)&lt;/strong&gt; are currently in characters or letters. &lt;code&gt;[‘Versicolor’, ’Setosoa’, ‘Verginica’]&lt;/code&gt;. We need to somehow convert this into a meaningful number that the machine learning can understand.&lt;/p&gt;

&lt;p&gt;It could be easier to do [0, 1, 2] right? &lt;br&gt;
&lt;strong&gt;But the problem with this approach is that the machine learning might think there’s a correlation in the order of the labels and might form a bias due to that order.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The recommended approach would be to use &lt;strong&gt;&lt;a href="https://medium.com/@michaeldelsole/what-is-one-hot-encoding-and-how-to-do-it-f0ae272f1179"&gt;one-hot encoding&lt;/a&gt;&lt;/strong&gt;. Fortunately, pandas has a built in one-hot-encoder function that we can conveniently use.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;train_y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_dummies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;val_y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_dummies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;val_y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Excellent! Let’s begin training our model. We’ll be using the Scikit-Learn's &lt;code&gt;RandomForestClassifier&lt;/code&gt; since we’re trying to &lt;strong&gt;classify&lt;/strong&gt; plants.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;sklearn.ensemble&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RandomForestClassifier&lt;/span&gt;

&lt;span class="n"&gt;random_forest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RandomForestClassifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;random_forest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;train_y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;random_state&lt;/code&gt; is basically shuffles our data to avoid any seeming order in our data. This makes sure that our model isn’t biased to the order of our given training data. &lt;/p&gt;




&lt;h1&gt;
  
  
  Testing our Model
&lt;/h1&gt;

&lt;p&gt;Let’s now validate our model using our validation data.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;sklearn.metrics&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;mean_absolute_error&lt;/span&gt;

&lt;span class="n"&gt;preds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random_forest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;val_X&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;mae&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mean_absolute_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;val_y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Mean absolute error is: {:,.5f}"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mae&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;random_forest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;val_X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;val_y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Mean absolute error&lt;/strong&gt; is the basically the average error of our model. The lower the mean absolute error the better the performance of our model is.&lt;br&gt;
The &lt;code&gt;.score()&lt;/code&gt; function gives us the score of the performance of our model on the validation data.&lt;/p&gt;

&lt;p&gt;Currently the mean absolute error is (I think) too low. And the &lt;code&gt;.score()&lt;/code&gt; is too high. There’s a possibility of &lt;strong&gt;data leakage&lt;/strong&gt;, even &lt;strong&gt;overfitting&lt;/strong&gt; on our model. &lt;/p&gt;

&lt;p&gt;I won’t dive in too much in to it but it’s best to avoid data leakage and overfitting in our models as these can severely affect the performance of our model.&lt;/p&gt;

&lt;p&gt;Let’s test our model shall we? I’ve manually placed a test data in our model to see what it would predict.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;preds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random_forest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;3.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;preds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It gives us the result:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Inspecting our y variable with &lt;code&gt;print(y)&lt;/code&gt; we could see that it looks like this: &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setosa&lt;/th&gt;
&lt;th&gt;Versicolor&lt;/th&gt;
&lt;th&gt;Virginica&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Looking at our prediction we can conclude that based on our given test data our model returned &lt;code&gt;versicolor&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Inspecting the data we can logically conclude that it is actually quite right!! &lt;/p&gt;




&lt;p&gt;Sweet!! We just trained a new model in predicting models. Incredible!! Give yourself a coffee break. ☕️ Congratulations 🎉🎉🎉&lt;/p&gt;

&lt;p&gt;Hope you enjoyed the My Machine Learning Journey series. I hope you also learned something 😅 I’m open to any feedbacks you might have or if there’s something that might be wrong, please do comment down below. &lt;/p&gt;

&lt;p&gt;For those trying to follow this code, I have a working &lt;a href="https://www.kaggle.com/interestedmike/iris-dataset-ml-model-sample"&gt;kaggle notebook&lt;/a&gt; for this example. &lt;/p&gt;

&lt;p&gt;Thank you! &lt;/p&gt;

&lt;p&gt;P.S. I've just uploaded my Hello World video on my Youtube Channel - &lt;a href="https://www.youtube.com/watch?v=oOOlcpEh2fQ"&gt;Coding Prax&lt;/a&gt;!  Drop by and say hi 😄 like and subscribe if you want to ✌🏽&lt;/p&gt;


</description>
      <category>machinelearning</category>
      <category>beginners</category>
      <category>diy</category>
      <category>handsdirty</category>
    </item>
    <item>
      <title>Setup for Machine Learning (Pt. 3)</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Sat, 05 Jan 2019 00:02:12 +0000</pubDate>
      <link>https://dev.to/benprax/setup-for-machine-learning-part-3-1c02</link>
      <guid>https://dev.to/benprax/setup-for-machine-learning-part-3-1c02</guid>
      <description>

&lt;p&gt;Machine Learning is heavily computational. You'll need to have some tools to be able to work with machine learning in your own computer. I recommend the following specs: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intel core i5 Gen processor &lt;/li&gt;
&lt;li&gt;4GB of RAM. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not necessary&lt;/strong&gt; but having a GPU is a great advantage. With GPU computations come way faster compared to CPU. &lt;/li&gt;
&lt;li&gt;For storage I’d recommend at least having 250 GB SSD. Having 120 GB is just too little especially when downloading large datasets and installing a plethora of libraries. SSD hard rives allows for faster reads and writes. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I recommend you watch Siraj Raval’s &lt;a href="https://www.youtube.com/watch?v=dtFZrFKMiPI"&gt;video&lt;/a&gt; for a more detailed explanation as to which laptops are good for machine learning.&lt;/p&gt;

&lt;p&gt;You should use a Linux based system. It's just so much easier to work with ml especially since you'll be using the terminal &lt;em&gt;aLOT&lt;/em&gt;. With Windows, it's not impossible, but it is definitely harder.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have  python (2.7 or 3.5 or newer) installed and add it to your path. &lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install pip after installing python. Watch my tutorial &lt;a href="https://www.youtube.com/watch?v=b2HoPw5Z1dY"&gt;here&lt;/a&gt;. &lt;br&gt;
&lt;em&gt;(please subscribe if it helped you. i'll be posting more content this year ✌🏽)&lt;/em&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/b2HoPw5Z1dY"&gt; &lt;/iframe&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optionally you can to install a virtual environment. I recommend using &lt;a href="https://virtualenvwrapper.readthedocs.io/en/latest/install.html"&gt;virtualwrapper&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a virtual environment you can easily manage different packages that you install with pip. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I recommend you also install &lt;a href="https://jupyter.org/install"&gt;jupyter notebook&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;jupyter&lt;/span&gt;
&lt;span class="c1"&gt;# do python3 if you installed python 3 or greater
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;With jupyter notebook you can immediately see the result of your code without having to go into a terminal and running &lt;code&gt;python *.py&lt;/code&gt; every single time you change a line of code. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optionally, you can also use a code editor and a terminal to run your code. I prefer the &lt;a href="https://code.visualstudio.com/download"&gt;VSCode editor&lt;/a&gt; and the &lt;a href="https://www.iterm2.com/"&gt;iTerm&lt;/a&gt; terminal, though you can also opt in to use the default Terminal in the Mac or Linux or any of your preferred code editors. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading! This is part 3 of a 4 part series. Next we'll talk about getting into the code of machine learning. &lt;/p&gt;


</description>
      <category>machinelearning</category>
      <category>setup</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Finding the Right Course (Pt. 2)</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Mon, 31 Dec 2018 01:42:11 +0000</pubDate>
      <link>https://dev.to/benprax/finding-the-right-course-for-my-machine-learning-journey-pt-2-50g1</link>
      <guid>https://dev.to/benprax/finding-the-right-course-for-my-machine-learning-journey-pt-2-50g1</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fx568maw2ycffti6ofv4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fx568maw2ycffti6ofv4p.png" title="Photo by Simon Migaj on Unsplash" alt="Finding the Right Course"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome. Let’s begin, shall we?&lt;/p&gt;

&lt;h2&gt;
  
  
  The What
&lt;/h2&gt;

&lt;p&gt;The first hurdle to my machine learning journey is, WTF is machine learning?&lt;/p&gt;

&lt;p&gt;"Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.” - Source &lt;a href="https://www.expertsystem.com/machine-learning-definition/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So basically it’s an application of AI that gives the system the ability to learn from experience without the “if/else” conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;p&gt;Why would we want to learn machine learning? The simple answer would be why not? Having the power of creating something that could potentially make us as a human better that could help us in our daily lives is freaking awesome! Also, you could probably create your own JARVIS (like Tony Stark) which is kinda my goal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where To?
&lt;/h2&gt;

&lt;p&gt;So now the question is how do I begin learning ML? &lt;/p&gt;

&lt;p&gt;Well, first you’ll need a programming language to use. You can choose from Java, Python, C# and other languages. I’ve grown comfortable with Python and there are already lots of ML communities using python so for the rest of our journey, we’ll be using Python. I recommend the &lt;a href="https://www.codecademy.com/learn/learn-python-3" rel="noopener noreferrer"&gt;Codecademy&lt;/a&gt; course if you haven’t learned Python.&lt;/p&gt;

&lt;p&gt;You’ve probably googled how to learn ML and you might have read somewhere that it takes a lot of knowledge of math to get started. That’s not really the case. Yes, learning the math can be very helpful, but sometimes, even the simplest knowledge can be very powerful. &lt;/p&gt;

&lt;p&gt;So even with the simplest models and not too much math know-how, you can already do so so much! That’s great news ain't it?&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding the Map...
&lt;/h2&gt;

&lt;p&gt;Now to find a tutorial.&lt;br&gt;
I’ve searched lots of ML tutorials around the web. I’ve checked out Sentdex, Udacity, Google, and Coursera. But I found that the best tutorial for me is Kaggle.&lt;/p&gt;

&lt;p&gt;What is Kaggle? Taking from a notebook by Zeeshan-ul-hassan Usmani:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;"Kaggle is an AirBnB for Data Scientists.”&lt;/li&gt;
&lt;li&gt;"Kaggle enables data scientists and other developers to engage in running machine learning contests, write and share code, and to host datasets."&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Check out &lt;a href="https://www.kaggle.com/" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Kaggle hosts hundreds of thousands of datasets for data scientists and developers to use. It also hosts competitions that developers and data scientists can engage in. You could even win prize ($$$) on some of those competitions.&lt;/p&gt;

&lt;p&gt;What many don’t know is that Kaggle also has a “&lt;a href="https://www.kaggle.com/learn/overview" rel="noopener noreferrer"&gt;Learn&lt;/a&gt;” section so that you too can start learning about ML, Deep Learning, Data Visualisation, and tons of other stuff!&lt;/p&gt;

&lt;p&gt;Learning at Kaggle is so easy because it has these little “notebooks” which contain the text, the code, and the result from that code. These little notebooks easily explains concepts of the topics and what they do without driving you off to imagination land. Plus, the data used for the code is easily found within the "Data" tab of the notebook which you can download and experiment yourself. HURRAH!💥&lt;/p&gt;

&lt;p&gt;Kaggle also has a great community mixed with experts and noobs like me. So you are never left out. &lt;/p&gt;

&lt;p&gt;This post isn’t sponsored by Kaggle and I’m not in any way affiliated by it. I just really love learning at Kaggle ❤️&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. We all have different styles of learning. I love reading short articles that easily explains stuff in as little code as possible that can work for my particular use, and Kaggle easily does this for me. You should definitely checkout Sentdex, Udacity, Google, and Coursera as they offer great and comprehensive content that might also fit your learning style&lt;/em&gt; 😉&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>My Machine Learning Journey (Pt. 1)</title>
      <dc:creator>Michael Learns</dc:creator>
      <pubDate>Thu, 27 Dec 2018 14:46:49 +0000</pubDate>
      <link>https://dev.to/benprax/my-machine-learning-journey-pt-1-9cm</link>
      <guid>https://dev.to/benprax/my-machine-learning-journey-pt-1-9cm</guid>
      <description>

&lt;h4&gt;
  
  
  Hi! How do I even begin?
&lt;/h4&gt;

&lt;p&gt;That’s like the first thing we always seem to ask and it ain’t easy to answer that question. Every new adventure always comes unplanned. You never really know where to begin.&lt;/p&gt;

&lt;p&gt;Maybe, a little introduction.&lt;br&gt;
Hey! My Name is Ben Prax, and I’m homeschooled.&lt;/p&gt;

&lt;p&gt;I’m &lt;strong&gt;no machine learning expert&lt;/strong&gt; &lt;em&gt;(yet)&lt;/em&gt;.&lt;br&gt;
I’m &lt;strong&gt;not a graduate&lt;/strong&gt;. &lt;br&gt;
I’m &lt;strong&gt;not good at math&lt;/strong&gt; &lt;br&gt;
&lt;em&gt;(probably something almost everyone can relate too, am I right?).&lt;/em&gt;&lt;br&gt;
I &lt;strong&gt;barely understand the math&lt;/strong&gt; under the hood of the machine learning models.&lt;br&gt;
I’m &lt;strong&gt;not always focused&lt;/strong&gt;. I let little things distract me, which is a &lt;strong&gt;TERRIBLE habit&lt;/strong&gt; by the way. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Which is also why I decided to do this post to really push myself to study.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;More on that later.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I don’t know many experts in my area who I can find tutor or training specific to machine learning.&lt;/p&gt;

&lt;p&gt;I do however have the following: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A laptop &lt;/li&gt;
&lt;li&gt;The internet &lt;/li&gt;
&lt;li&gt;A brain&lt;/li&gt;
&lt;li&gt;Google&lt;/li&gt;
&lt;li&gt;Willingness to learn&lt;/li&gt;
&lt;li&gt;Determination&lt;/li&gt;
&lt;li&gt;Curiosity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I’m also aware of some communities who are into machine learning.&lt;br&gt;
Communities are there to help you, but majority of the time, &lt;strong&gt;you’re on your own googling questions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Curiosity and determination and the willingness to learn are probably the most crucial in the 7 items above. Without these you probably won't even bother reading this post, right? So let your curiosity flow and feed it with knowledge. Be determined and be willing to learn fully aware that you'll make mistakes along the way. Accept it and move on with the new learning.&lt;/p&gt;

&lt;p&gt;The purpose of this post (article, diary, blog, whatever) is to encourage all those who want to start their machine learning journey. &lt;/p&gt;

&lt;p&gt;Hopefully, you’ll learn a thing or two of the struggles I will be facing, trying to understand this mysterious black box called Machine Learning (ML). 🤔?&lt;/p&gt;

&lt;p&gt;Maybe we can also celebrate together when we’ve finally uncovered these mysteries and riddles and puzzle our knowledge together. 🎉🎉&lt;/p&gt;

&lt;p&gt;I hope you enjoy as you follow along my journey in studying machine learning. &lt;/p&gt;

&lt;p&gt;If you can suggest something that you think might help me and other readers, don’t hesitate to comment. &lt;/p&gt;

&lt;p&gt;Thanks for reading. Let’s begin! 😄&lt;/p&gt;


</description>
      <category>machinelearning</category>
      <category>newbie</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
