<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jacob Menashi on Medium]]></title>
        <description><![CDATA[Stories by Jacob Menashi on Medium]]></description>
        <link>https://medium.com/@jbmenashi?source=rss-881e6825ec45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aOfN0ZTW4cLQ8Xgo</url>
            <title>Stories by Jacob Menashi on Medium</title>
            <link>https://medium.com/@jbmenashi?source=rss-881e6825ec45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:23:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jbmenashi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Data Scientist Journey, Chapter 8]]></title>
            <link>https://medium.com/@jbmenashi/the-data-scientist-journey-chapter-8-76a4f32bf19c?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a4f32bf19c</guid>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Mon, 29 Apr 2019 03:46:00 GMT</pubDate>
            <atom:updated>2019-04-29T15:21:12.101Z</atom:updated>
            <content:encoded><![CDATA[<h4>Scrapin’ the Web</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F10WZuz2REXhykU%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F10WZuz2REXhykU%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F10WZuz2REXhykU%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="327" frameborder="0" scrolling="no"><a href="https://medium.com/media/131a7ab457f790db0a6e7440fab85716/href">https://medium.com/media/131a7ab457f790db0a6e7440fab85716/href</a></iframe><p><em>This is the 8th installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>One aspect of learning Python that I was really looking forward to was web scraping, the act of getting data from off the web through the HTML. There’s lots of free data out there to use for scraping, including many options when it comes to sports (there’s also a lot of data that you’re not supposed to scrape, so you have to be careful!). I’m going to quickly go through the process of web scraping with Python today, before diving deeper into it next week with some projects.</p><h4>Using BeautifulSoup to Scrape</h4><p>Like most of the things I’ve shown on this blog in the last couple installments, we get the ability to scrape sites with use of a package — this one is called Beautiful Soup. We have some example HTML here to show how BeautifulSoup can parse through it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*5HiA02NwsyQQUOQKWTGXww.png" /></figure><p>With this HTML, you can see there’s a few different elements, a couple &lt;div&gt; tags as well as an &lt;ol&gt; ordered list with some &lt;li&gt; list items. Using BeautifulSoup, we can access these elements in many different ways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*RZtMUiUQuEIWM5WJQl-6-w.png" /></figure><p>This is the key line in using the package, it specifies what we are parsing through (saved into a variable called ‘html’) and then how we want to parse it, obviously using the html.parser in this case, though you can also look through XML with this package.</p><p>For those of you who have a JavaScript background like me, the methods you use to get certain elements/data out of HTML will look very similar, as they match up quite nicely to what you see in regular JS or JQuery. For example, let’s say you wanted to grab all the elements with a class of “special”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*YovvXzrZSvHz15-QsF4CkQ.png" /></figure><p>Looks familiar right? the “get_text” method is like calling “.innerHTML” or “.innerText”, and the “name” method is the same. The “attrs” method is helpful as well, if an element has a class, id, or even a datatype.</p><p>Continuing with that analogy, you can find parents, children, and siblings of HTML elements just like you can do in JavaScript:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*q6py_riThyT0gneJ5I6LTQ.png" /></figure><p>In this example, we are using select, which finds every instance of the parameter and returns a list. The [1] signifies that we want the second element in this list, and “find_previous_sibling” is a method that will eventually return us the ordered list, as it is the previous sibling of the selected &lt;div&gt; element. Navigating isn’t too hard!</p><p>Next week, some real web scraping projects!</p><p><a href="https://www.udemy.com/the-modern-python3-bootcamp/">Code with Python (The Modern Python 3 Bootcamp)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76a4f32bf19c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Data Scientist Journey, Chapter 7]]></title>
            <link>https://medium.com/@jbmenashi/the-data-scientist-journey-chapter-7-498f56c14fd0?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/498f56c14fd0</guid>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sun, 21 Apr 2019 23:30:45 GMT</pubDate>
            <atom:updated>2019-04-21T23:30:45.982Z</atom:updated>
            <content:encoded><![CDATA[<h4>Finally Working with Files!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nyS92ZfSqIR4YTd4Jb0_xw.png" /></figure><p><em>This is the 7th installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>It’s funny that after a month-and-a-half of writing these blogs about becoming a data scientist, I haven’t really encountered any actual data, aside from a brief sojourn into making HTTP requests. But you have to crawl before you can walk, and so this week we excitingly get to work with reading and writing data, from both text and CSV files! This is a great step because with all of the sports data that I’ve seen, it usually shows up in CSV, which stands for comma-separated-values, so I’m considering this week as a big milestone (even if we’re not doing much with the data itself)</p><h4>Reading and Writing with Text Files</h4><p>Here’s the most basic text file you could have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*JhCcYIGN9XxJp_DEw-w0yg.png" /></figure><p>Over in that reading_files.py file, there are lots of methods we could use to look at that amazing line of text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*YNayYOxbFD5tFjZtKNOObg.png" /></figure><p>I put some comments in there for my sake, but going through them, every time you want to look at a text file, you need to open it — this lets Python know we’re good to go. At the end of all this action, you need to close the file — there’s actually a way around this open/close system which we’ll get to in a second.</p><p>file.read() is the key method here; if you were to call that in your Python terminal, it would print out the text from test.txt. However, if you were to call it again, you would get an empty set of quotes, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*8EUmOXE5Yxk87XqMGqf5KQ.png" /></figure><p>That’s because once the file is read, Python’s “cursor” is at the end of the file — think of it as like when you highlight something in a Word doc, your cursor ends up at the end of where you highlight. That’s what the .seek() method is for. By calling it with ‘0’ as an argument, it puts it right back at the beginning of the file — it’s indexed so you could put whatever eligible number you want in there.</p><p>So instead of opening and closing the file every single time, we can use the ‘with’ keyword, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*uUnVpQWlazLQqzZ7hxC0Xg.png" /></figure><p>This comes in handy when we move on to the next step, writing text to test.txt (try saying that 5 times fast!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*49VQ9K6wR5sp5RLkiH6oiw.png" /></figure><p>These are two different files squished together, but it should make sense. The main difference is on line 2, where we have a “w” sitting next to our file name. The “w” is a flag for the open() function that Python comes with, an extra parameter if you will — it tells the function to write, not read (read is default so you don’t need the flag). Then you can call the actual “write” function, and there you go, a line of text!</p><p>There are lots of different flags you can use, and that’s helpful because let’s say we wanted to add another line? Using the “w” flag again would overwrite the first line, so we can instead use the “a” flag, which is short for append, to put the two lines together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*w0FZcRBsL4js5YOSKH0ZGA.png" /></figure><h4>C! S! V!</h4><p>These text files are great and all, but let’s get into some data! Like I said in the intro, CSV files are super common when it comes to data, as they’re in a format that is easily convertible. In fact, Python has a built-in module for csv work that we’ll be using a lot here.</p><p>For my data set, I took the statistics of one of the best baseball players around, Mookie Betts, the right-fielder for the Boston Red Sox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lWeZd0DIiQ11dtgJfx9r9w.png" /></figure><p>As you can see, there’s a lot of data there, all separated by commas (hence the name). Reading and writing with csv is pretty similar to what we saw above, except in this case we can turn it into either a list *or* a dictionary depending on what method we use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*PSb8TwwXFvCp_a8fvkBtbg.png" /></figure><p>On the second line above, reader is a function built-in to the CSV module, and it works exactly like the read() function. If I were to print out csv_reader, I would get a giant list, made up of lists, where each list inside is a row of data, and each value is an element in that data. The third line is is an iterator — I’m using it because without it, the first line that would be printed out would be all the category headers, and who wants to see that?</p><p>If we would rather convert the data into a dictionary, the methodology is pretty similar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*d2kwa-ptRH4Tr9v-XLhVJg.png" /></figure><p>This is much more ideal because now we can use the headers to our advantage. Instead of a row of just headers, now every element in the dictionary has the header as a key, and the value as a value. This is what gets printed out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*Va7C0YPX1dsSUQmnUU-A9Q.png" /></figure><h4>My Trusted Resource</h4><p><a href="https://www.udemy.com/the-modern-python3-bootcamp/learn/v4/content">Online Courses - Anytime, Anywhere | Udemy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=498f56c14fd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Data Scientist Journey, Chapter 6]]></title>
            <link>https://medium.com/@jbmenashi/the-data-scientist-journey-chapter-6-9ac4eccf68a4?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ac4eccf68a4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 23:00:59 GMT</pubDate>
            <atom:updated>2019-04-10T23:01:36.446Z</atom:updated>
            <content:encoded><![CDATA[<h4>You down with more OOP?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vPVEPlVKhDcv2nZ4" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>This is the 6th installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>My last blog covered some of the basics of classes — how to set them up and write methods and such. This entry is all about how classes can interact with each other, sharing information and methods to create more functionality. I’m covering inheritance, magic methods, and iterators as well!</p><h4>Putting Classes Together</h4><p>An important thing to know with classes is that other classes can access them, which makes sense because other classes can access lists, dictionaries, etc. Let’s start off with a simple class that creates a playing card.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*YhhDARgn9PIXL_RVmPR7ww.png" /></figure><p>Nothing much to see here, except for that instance method, __repr__, which like __init__ is called a dunder method because of the double-underscores before and after. __repr__ is short for “representation” (I think), and it’s how an instance of your class will be displayed on a print or return, so in this case we want a Card class to look like “A of Spades” when we see it in the console. We now have one card, but what about a whole deck?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*HXPouhFAv4r7d-VhkSOWcw.png" /></figure><p>The deck class only has one attribute, cards — which is a list of Card instances that we create with a list comprehension, taking every value and suit and instantiating a Card. This is how simple it is for classes to come together and work in tandem.</p><h4>Inheritance and the MRO</h4><p>Above was an example of classes essentially existing side-by-side, where both Deck and Card had their own attributes and methods. But it’s just as important to have a way for classes to share those components, and with that we get the system of inheritance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*z_h6QKXdS7YAjZp8DhcBZw.png" /></figure><p>This is another simple class, Animal, that has a couple different attribute, name and species. We see that __repr__ method again, just spelling out what we want to see on the screen, and a make_sound method that prints out a different string. The idea behind inheritance is that not all animals are the same, even if they all have a name and a species, so why should they be classified that way?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*ahOyvgi6UOfO3KivejrzKQ.png" /></figure><p>When the Dog class is created, it has “Animal” in parenthesis, which *inherits* all the qualities of the Animal class — both the init and methods. The init is inherited a little bit differently; when the Dog version of __init__ is made, it still takes in a name and species. But instead of needed to write “self.name = name” as an attribute for Dog, calling super().__init__ means that the code knows it’s taking that attribute from Animal. Same goes for species, only in this case we can actually set the attribute’s value right away (because the dog isn’t going to change it’s species).</p><p>Underneath that, we have the same method we see in Animal, make_sound; however, it has a different return value. If you were to call the method on an instance of a Dog, which method would run? Thanks to something called Method Resolution Order, it would be the one created in the Dog class first. MRO is just a way of determining which method comes first if there are multiple versions of the same one, which comes up a lot in inheritance.</p><h4>Magic Methods and Iterators</h4><p>We’ve seen two kind of weird-looking methods throughout these examples, __init__ and __repr__. Those dunder methods, also called magic methods, ALSO called special methods are really important, because all classes have access to them. There’s like a thousand of them, and not every class has every method, but any class you make can!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*P2YVOtqDvAFVzVkO8TnjXQ.png" /></figure><p>This example uses two magic methods, __iter__ and __next__. __iter__ turns whatever you feed it into an iterator, something that can be iterated over (that’s a lot of alliteration!). __next__ is used to tell the program to continue to go to the next item in the iterator until there are no more items left. The point of this is that all created classes have access to the same kinds of methods that exist already in Python, and are endlessly customizable.</p><p><a href="https://www.udemy.com/the-modern-python3-bootcamp/learn/v4/content">Online Courses - Anytime, Anywhere | Udemy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ac4eccf68a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Data Scientist Journey: Chapter 5]]></title>
            <link>https://medium.com/@jbmenashi/the-data-scientist-journey-chapter-5-49a5aca02ada?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/49a5aca02ada</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sun, 07 Apr 2019 23:41:20 GMT</pubDate>
            <atom:updated>2019-04-07T23:41:20.986Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Classiness of Object-Oriented Programming</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oKIPjHCmuXqdVvak8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oKIPjHCmuXqdVvak8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3oKIPjHCmuXqdVvak8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="323" frameborder="0" scrolling="no"><a href="https://medium.com/media/d28709529a111c9c10463ff633f469d2/href">https://medium.com/media/d28709529a111c9c10463ff633f469d2/href</a></iframe><p><em>This is the 5th installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>So far in this journey, we’ve pretty much covered all the basics when it comes to Python. We know about lists and dictionaries, loops and comprehensions, and lots and lots of functions. So how do you put it all together? This week, the focus of my studies is on Object-Oriented Programming in Python, the most common way you’ll see all of those components working in harmony. OOP is certainly not limited to Python, as it is the backbone to Ruby and JavaScript as well, and I imagine countless other languages. It is a great way to organize, encapsulate, and abstract code, so let’s go through it!</p><h4>Classes and Instances</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*ynHe9DURkl7I41Qvbtywiw.png" /></figure><p>Classes are the backbone of OOP — they are where instances of the objects are created, and where the methods that those instances can use are defined. Above is a super basic class setup: the first thing that happens with every class is an __init__ function. The double underscore (or “dunder”) method is not a weird typo — it’s a built-in Python function that the language knows is a class method for creating instances. An instance is what it sounds like, an instance of a class, and the __init__ function is where the different attributes of the class are determined. In that above example, we have a user class, that has the attributes of first_name and last_name, as well as something called “self”. Self is another keyword that is referring to the instance itself, so that you can set up its keys inside the function. Underneath the __init__ function is an example of creating an instance — you don’t need to actually use self as an argument there, just the attributes you’ve added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*Z0eOUOSQDAr_QTw-pBPGUQ.png" /></figure><p>Let’s take a look at some instance methods. Here we have a Game class with some attributes, home, away, and score. The first instance method we see is “matchup”, which just returns a string of the home and away team. By providing self as a parameter, we get access to all of self (which is a representation of the instance we’re calling the method on), and all of its attributes. In this case, we can use the away and home attributes to print out the correct string.</p><p>The parameters are as flexible as any other method. In the second one, we still have self as a parameter that allows us to bring in the score, but we have a second parameter “player”, that would be filled in when the method is called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*QC0x8qCtdgLCjqss45r86w.png" /></figure><p>This example introduces a couple more concepts — class variables and class methods. Outside of the __init__ function there is a variable called total_eggs which is set to 0 — this is kind of like a global variable *within* the class, in that all instance and instance methods know about it. A Chicken instance has an attribute called eggs, which always starts off at 0 (attributes in the __init__ function don’t always need to be instantiated by the user). The lay_egg method increments BOTH the instance’s egg count AND the overall class egg count by 1.</p><p>Underneath that, we have something new called a decorator which lets the program know that this is a class method (there will be more on decorators in coming installments). Instead of passing in “self” as a parameter for this method, I’m passing in the entire class, and because total_eggs is a variable we set within the class, it works as an attribute as well, which is why we can return it like that.</p><p>This is a bit of a shorter blog than usual, but next week, a deeper dive into OOP with some interesting examples!</p><h4>Resources</h4><p><a href="https://www.udemy.com/the-modern-python3-bootcamp/learn/v4/content">Online Courses - Anytime, Anywhere | Udemy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49a5aca02ada" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Data Scientist Journey: Chapter 4]]></title>
            <link>https://medium.com/@jbmenashi/the-data-scientist-journey-chapter-4-d2fdf6f871a?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2fdf6f871a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sun, 31 Mar 2019 19:28:58 GMT</pubDate>
            <atom:updated>2019-03-31T19:28:58.637Z</atom:updated>
            <content:encoded><![CDATA[<h4>Modules, HTTP Requests, and Some Bonus Functions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*3sQqEsyEeeQb4nR65_1ZcA.png" /></figure><p><em>This is the fourth installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>I can’t believe it’s been nearly a month since I started learning Python — maybe it’s because I’m still just scratching the surface! It’s been hard balancing my studies with applying to jobs, working on internships, and building some JS projects, but I’ve hit some new features of the language this week, and now it feels like I’m getting into the good stuff. Before I go into modules and how to make web/API requests with them, I want to cover one more important function that I didn’t last time.</p><p>Also, before going any further, I realize that I’m not giving credit to the Modern Python 3 Bootcamp course where I’m learning all this great stuff. The link is at the bottom, if you want to check out the class yourself!</p><h4>The Zip Function</h4><p>Last time, we went over some of the more interesting built-in functions that Python comes with, like map and filter. There was one more big one that I’ve covered since, and that’s the zip function — a way of combining two different datasets into one (like you’re zipping them together), like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*lwl7NoJ7HSV4zW-qxaiFtA.png" /></figure><p>So in that example, we’re taking two different lists and making either a new list or dictionary out of them. The new list is a list of tuples with matching indexes of the two lists (zip will always do as many pairs as the *smaller* dataset can provide), while the dictionary makes the first list the keys and the second list the values.</p><p>So when could this come in handy? Using the example from the course, lets say you had some students in a class, and needed to get their highest score from a couple different tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*TcGDmKRT5Bu5UXndHiFo8g.png" /></figure><p>You can use a zip function AND a dictionary conversion to solve this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*qnwb4-JX8SZhEpmRGYVEyw.png" /></figure><h4>Modules</h4><p>Okay, the function detour is out of the way — let’s talk about modules. I’m not sure if this is a stretch, but modules in a lot of ways feel like gems in Ruby or libraries in JavaScript. Now a gem or a library is a little bit more complicated, in that they’re their own collection of code/rules whereas a module can literally just be a single file, but what do all three really give you? A list of available functions you can use anywhere in your code.</p><p>We’ve worked a little bit with python’s built-in module “random”, which to recap, looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*4-h0HKUrVeuif6c_VJ5fYw.png" /></figure><p>So you can either import an entire module, or you can just import specific functions from a module (which makes sense for memory/space, because some modules have lots and lots of functions). Python has so many built-in modules, which you can find here:</p><p><a href="https://docs.python.org/3/py-modindex.html">Python Module Index</a></p><p>Not only that, but you or anyone can create a module that other people can install. Let’s take a look at one of the most popular ones.</p><h4>Making HTTP Requests</h4><p>So when I eventually progress towards making my own projects using datasets, I’m most likely going to be getting my data from an API. In the past, I used Ruby on Rails to process my work with APIs, through the Ruby gem rest-client. In Python, instead of a gem, I can use the module “requests” to provide the resources for parsing through data. After importing requests like any other module, take a look at these steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*_mB0T8dIfTYLO9ju_mWwdA.png" /></figure><p>Using a URL from the internet, I can call a method called “get” from the requests module to receive JSON data from that URL. In this case, I’m looking to search a specific term on the site and get back a list of jokes. The headers and params are optional arguments with the get method that decide what kind of data I’m getting back, and what extra queries need to be on the URL. The actual response I’m getting back is a traditional HTTP status code, where 200 means it’s processed correctly. If I print out the response.json(), with the search term “cat”, this is the data I get back:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*etTBaavqcR72YGQJM7aoXw.png" /></figure><p>Not really what I want right? I just want a random joke from that big dictionary of data. So here are the steps I can take from there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*GRD5DonneYzTpOwp2bzpjQ.png" /></figure><p>So now I’m using *another* module that we’ve seen, it’s random! After I import that, I can go through all the results that we have, and grab a random joke (if that search term has any jokes available). And there you go, that’s how you make requests in Python. This will be a crucial component going forward.</p><p>Next time: Object-Oriented Programming!</p><h4>Resources:</h4><p><a href="https://www.udemy.com/the-modern-python3-bootcamp/learn/v4/content">Online Courses - Anytime, Anywhere | Udemy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2fdf6f871a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey to Data Scientist, Chapter 3]]></title>
            <link>https://medium.com/@jbmenashi/my-journey-to-data-scientist-chapter-3-adc673cef029?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/adc673cef029</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sat, 23 Mar 2019 17:59:59 GMT</pubDate>
            <atom:updated>2019-03-23T17:59:59.424Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s Functionin’ Time</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FitV8NkzPokMRG%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FitV8NkzPokMRG%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FitV8NkzPokMRG%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3f261a77c8592063c630d4b9327364b/href">https://medium.com/media/c3f261a77c8592063c630d4b9327364b/href</a></iframe><p><em>This is the third installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><p>The backbone of every programming language that I’ve encountered so far is the function. Functions are pretty straightforward in their purpose — it’s a grouping of code that can accept information, perform a task (or many tasks), and output a result depending on that information. Functions can be one line or 100 lines, and they can do everything from print your name to parse millions of lines of data — pretty powerful! I’m going to go over basic functions in Python, and then cover some quirks that I’ve noticed while learning this new language.</p><h4>Function Structure and Syntax</h4><p>I won’t spend too much time with this section, only because there isn’t too much new stuff when it comes to building a basic function. The structure is pretty similar to Ruby in that there aren’t 1,000 brackets everywhere and that every function is declared with a “def” in front, although Python doesn’t need an “end” to conclude it. I personally don’t love that, because it sacrifices some of the readability to me, but it’s still a little bit better than the madness of JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*djtGi19cUsX41TszXoqbIQ.png" /></figure><p>You do need a return keyword, unlike Ruby but like JavaScript — that’s been one of the most interesting things about learning to program in a few different languages, in that they’re all very similar in a lot of ways, they share certain aspects but differ in others. Maybe someone will create the universal language someday…</p><h4>*Args and **Kwargs</h4><p>For the most part, parameters in functions work the same as I’ve learned before, including setting default parameters when no parameters are given. But what about when you don’t know how many parameters there are going to be, like if you have an ever changing list of numbers? I’ve come across shifting params in other languages, but in Python, they are referred to as *args (star-args) and **kwargs (apparently actually pronounced “quargs”!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*5niprmIzELV3bB644mGeBg.png" /></figure><p>In the above function, the *args can be any number of arguments given when the function is called, and the function will successfully total all the arguments together. One thing to be clear with though: if you were to use that function with a data structure that *isn’t* a tuple, Python would freak out, because the *args is converted into a tuple. That’s just how it works.</p><p>**kwargs are pretty much the same deal, except we’re working with dictionaries as the parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*chY0zlHiB2JQTf1t1TTqfA.png" /></figure><p>So instead of taking in a tuple of varying length, it will take in a dictionary of varying length, and still accomplish the same task every time. For now, I won’t be using too many of these kinds of parameters, but I can see them being very useful down the line when dealing with ever-changing data.</p><h4>Filter and Map</h4><p>So far in all three of these blogs I’ve used a lot of Python’s built-in functions, like len() or count(). At this point, it’s time to bust out the big guns of the built-in brigade, filter, map, and zip.</p><p>The first two are very similar in nature, in that they make use of a <em>lambda</em> function, which is the same thing as an anonymous function in JavaScript. Both filter and map take a data structure and output a mutated data structure based on the conditions of the lambda function. Filter is used to (gasp!) filter out specific data, while map changes every item in the dataset, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*qpqjK8Qrl3VrGoTQuQJ3yQ.png" /></figure><p>Let’s break those down. The first function is designed to create a list of only even numbers out of a bunch of integers. The filter function takes two arguments, a lambda function and an iterable, which in this case is the variable more_nums (a list). The lambda function is just another function without any of the thrills — it’s kind of like a list or dictionary comprehension in a lot of ways too. Instead of saying “num % 2 == 0 for num in nums”, we’re just writing it out as if “num” is a parameter, and “num % 2 == 0” is what you want to return. In fact, you *could* just do a list comp on this if you wanted to.</p><p>Map is pretty much the same structure, just a different outcome. It takes every number in nums and doubles it. The only important things to add, and this goes for filter too, is that you need to convert the result of these functions into a list so that you can see the actual result. You can even combine them!:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*a_KeeC8y-jlznEBhQfLhrw.png" /></figure><p>In that example, the second argument of the filter function is still an iterable list, it’s just a list that’s been mapped over. Pretty cool!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adc673cef029" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey to Data Scientist, Chapter 2]]></title>
            <link>https://medium.com/@jbmenashi/my-journey-to-data-scientist-chapter-2-8f15474b2602?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f15474b2602</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sun, 17 Mar 2019 19:31:28 GMT</pubDate>
            <atom:updated>2019-03-17T19:31:28.533Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lists &amp; Dicts &amp; Tuples &amp; Sets</h4><p><em>This is the second installment in a ???-part series about my journey to becoming a data scientist in the field of sports analytics. With a background in sports production and an education as a web developer, follow me as I learn new languages, work on projects, and have a grand ol’ time doing it.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FA06UFEx8jxEwU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FA06UFEx8jxEwU%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FA06UFEx8jxEwU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="320" frameborder="0" scrolling="no"><a href="https://medium.com/media/649b348358107ce45ff2a26ef30f6eff/href">https://medium.com/media/649b348358107ce45ff2a26ef30f6eff/href</a></iframe><p>This past week I’ve continued my Python course, and now I’m really in the thick of things. I’ve progressed into the complex world of lists and dictionaries, discovered some new data structures called tuples and sets, and dived into the meat of every programming language, functions. I still haven’t gotten around to building anything substantial yet (which makes sense because it’s only been 2 weeks), but today I’ll go over a few of the new and interesting things I’ve discovered in Python about the above topics.</p><h4>Comprehending Comprehensions</h4><p>One thing about both Ruby and JavaScript that I didn’t love was how it was occasionally difficult, and sometimes downright annoying, to try and get or manipulate information out of a list or an object. It would sometimes require a bunch of seemingly extraneous code, when it felt like I should be able to accomplish the task in only 1 or 2 lines. With Python, there’s finally a way for me to see this happen: comprehensions.</p><p>Both list and dictionary comprehensions are pretty similar, in that they create a new list or dictionary out of an existing dataset, depending on the conditions set out by the comprehension. Say you have a list, [1, 2, 3, 4, 5], and you wanted to multiply every number in the list by 10 and save those values into a new list. In JavaScript, you could do something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*5zcAeRK2FJrCJ4LQ_qI9EQ.png" /></figure><p>There are more creative ways to do that function in JS that would shorten the function, but I think it’s important to show that way because that’s how it’s taught at a basic level in any course or class I’ve been in. Learning Python, the basics are way more streamlined:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*betwPlLW22-wrRvu5YAK0w.png" /><figcaption>Easy Peasy!</figcaption></figure><p>Just two lines, and it even reads simpler because that’s the beauty of Python! It’s saying “return an array (the brackets outside) of a number times 10 *for* every number *in* the list.” The use of appropriate keywords is super helpful here.</p><p>This was a pretty simple example, but it’s even more pronounced when looking at dictionary comprehension. A practice question I run into a lot is, given a string, create an object that counts the frequency of every character in a string. So for example, given the string “science”, you’d want to return an object {s: 1, c: 2, i: 1, e: 2, n: 1}. Here’s what that looks like in JS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*8NQCHP1l8hjuDEJUzR2qww.png" /></figure><p>That’s kind of a huge block of code for what should be a simple task. So here it is with a dictionary comprehension in Python:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*b8GGiGWe4xDAJCcIQ-F5Dg.png" /></figure><p>Look at that! Two lines, so neat and concise. Once again, it’s creating a new dictionary (hence the curly braces on the outside), and setting up a new key-value pair in the first part — the key is the character, while the value is the count (what a helpful helper function) of the character in the string, and the second part is just like the list comprehension, just doing it for every character in the string. There’s so much to do with list and dictionary comprehensions, but even these basic examples should show what they’re capable of.</p><h4>Tuples and Sets</h4><p>A little bonus feature of this week’s blog: two new data structures! Tuples and sets are two types of data containers that I had never encountered in Ruby or JavaScript, and like with most things so far, I don’t totally know what I’m going to be doing with them just yet, but they’re certainly interesting!</p><p>Here’s a tuple:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*6NiGdtjtpvhohvzWlrFAwQ.png" /></figure><p>Note the regular parenthesis, that’s what makes it a tuple. In a lot of ways, it’s just like a list, in that you can access the data through indexes, and run functions like count() and len() to get information about the data. However, the key with tuples is that they are *immutable* — the data can never change once it’s there. So you could use it for something like days of the week, but for a data scientist working with active data, I’m not sure what the benefits are.</p><p>Sets are a little more interesting, here’s two of them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*3lOcPJjQk_gXlNO9qpsWRA.png" /></figure><p>They look kind of like dictionaries, but with data that looks like a list. Sets are kind of mutable — you cannot *change* any of the data inside, but you can add or remove data. Also, duplicates within a set don’t exist; if I tried to add “Ramos” to the real set, nothing would change.</p><p>There’s also some interesting set math you can do, called unions and intersections, which are useful when working with two different sets, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*XjECxhX-SgmdTf_9Bs7Plg.png" /></figure><p>That’s it for this week. Next week: Functions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f15474b2602" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey to Data Scientist, Chapter 1]]></title>
            <link>https://medium.com/@jbmenashi/my-journey-to-data-scientist-chapter-1-bd104f313f87?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd104f313f87</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Sun, 10 Mar 2019 19:55:15 GMT</pubDate>
            <atom:updated>2019-03-10T19:55:15.911Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Web Developer Exploring New Worlds in Data Engineering</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FXIqCQx02E1U9W%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FXIqCQx02E1U9W%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExYTQ0Mjkzb3g5cTRxZGN6aDlsZmFqeGtjcmtpZjV5NHlwMm82cTV4ayZlcD12MV9naWZzX2dpZklkJmN0PWc%2FXIqCQx02E1U9W%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/20dd26b3f4a30417a1d1bfa6e0e51ea1/href">https://medium.com/media/20dd26b3f4a30417a1d1bfa6e0e51ea1/href</a></iframe><p>Having recently graduated from the Flatiron School with newfound knowledge in both front-end and back-end web development, I headed to the MIT Sloan Sports Analytics Conference armed with the confidence that I could find some great software engineering opportunities in the world of sports. While I was successful in that regard, I quickly came to realize that in the sports industry, there is one thing on everybody’s mind: data, data, data. Data analytics and modeling are what’s driving the sports world these days, and as a developer looking to be on the cutting edge, it’s definitely where I want to be.</p><p>Luckily, with my newfound ability to code in a couple different languages, I felt like it was a challenge I was ready to take on! This blog will chronicle my journey from web developer to web developer AND (hopefully) data scientist. I’m starting out with Python, then ideally SQL, R, and Tableau as I try to expand my abilities as much as possible. I’ll also be making projects along the way to put my knowledge to good use! Subjects will be subject to change as I figure out my strengths and weaknesses (hint: math), but I’m excited to see what happens. This first installment will go over my first impressions of basic Python, as well as a couple basic programs I’ve constructed so far.</p><h4>Python Syntax</h4><p>For the most part, Python syntax is way more similar to Ruby than JavaScript, in that it’s very user-friendly. JS is definitely catching up, but I can see why Python is one of the more popular coding languages out there. There are a few things that I feel separate it even from Ruby in terms of usability. The first major one seems pretty simple, colons. Instead of the do keyword in Ruby or an abundance of parentheses and brackets in JS, Python uses a : to separate out things like loops and conditional statements, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*spLBCqWT_QcUDLGQvrgp3g.png" /></figure><p>Note the colons at the end of the while loops as well after the if and else statements. To me, that is a very functional and practical way to write code, because it’s pretty clear what the code is trying to do, and it isn’t messy at all.</p><p>Another thing to notice in that example above is the lack of variable declaration keywords. This is a big difference compared to JS, and I’m not so sure I love it so far. Having “const” and “let” in JS helps determine the functionality of the variable for me, and you can also just declare a variable without assigning it to anything, which you can’t do in Python. When switching from Ruby to JS, that was one improvement I saw, so it will take some time getting used to going back to the old way.</p><p>Going back to the pleasant surprises, I’m a big fan of Python using words instead of symbols when the meaning of the word is obvious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*a98RqdrBRKWvMyIyY5x78A.png" /></figure><p>Instead of || it’s “or”, instead of &amp;&amp; it’s “and”, and in the above example you can even just do “is” instead of doing a ==. This is definitely a quality of Python’s user-friendliness, because it makes the code even easier to process. I can’t wait to find more aspects like this as I learn more of the language!</p><h4>Importing Modules</h4><p>I will definitely have more to expand on this in future installments, but the ability to import modules in Python is really helpful. I only have used the built-in module random, but some brief research tells me there are lots of different built-in modules, and you can create your own. Basically, a module hold a group of functions you can use throughout your document. In the random-number example from before, I used the random.randint() function, which was included in the random module. I’ve just scratched the surface with this, and I’m excited to see what’s in store with this feature.</p><h4>Rock, Paper, Scissors</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lx7W7TxHqu9JkZFL3b-ZzQ.png" /></figure><p>So here’s a little command-line project using conditionals and loops which is where I’m at in my Python knowledge so far. The user can play rock-paper-scissors against the computer, in classic best-two-out-of-three fashion. The user inputs their choice of rock, paper, or scissors, and then the computer random draws one of the three as well. Depending on the results, either the user or computer picks up a win, and it repeats until someone has 2 wins. The user then has the option to play again.</p><p>I’m starting off by importing the random module, so that I can use the choice() function on line 12, which allows you to pick out a random item from a list. I’m using a couple of while loops that determine on a larger level if the user wants to play again, and inside that whether or not the user/computer have enough wins to end the game. It’s simple stuff, but it’s always fun to translate skills I’ve learned in other languages and use them in new projects!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd104f313f87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Natural Language Processing]]></title>
            <link>https://medium.com/@jbmenashi/natural-language-processing-8cc41ab106ba?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cc41ab106ba</guid>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Fri, 18 Jan 2019 05:45:48 GMT</pubDate>
            <atom:updated>2019-01-18T05:45:48.884Z</atom:updated>
            <content:encoded><![CDATA[<p>Or, “How Does That Brain In My Phone Know What To Do?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*EppIMx_EbktMqLgnKcy9Dw.png" /></figure><p>In just the last 8 years, the commercial usage and technology behind Voice-Activated Assistants has essentially exploded. Siri’s debut on the iPhone 4S in 2011 was a major milestone for the industry, and in the following years, with Amazon’s Alexa and Google Assistant joining the market, VAAs have only increased in popularity and importance. Literally billions of devices have a VAA on them nowadays, and although people don’t even always use them as much as intended — most Alexa users have only made one Amazon purchase while owning the device, for example — they certainly aren’t going to be losing any relevance anytime soon.</p><p>VAAs are incredibly complex technologies that definitely cannot be explained fully in a blog post, but I want to touch on one of the major components that all VAAs rely on: Natural Language Processing. NLP is essentially the middleman when it comes to the work VAAs do, sandwiched in-between the technology recognizing your speech and saying something back to you? NLP is there to answer the question of when you give a command to your phone or home device, how does it know what to do with what you’ve said? To me, there are three main components to that process.</p><h4>Analyzing Intent</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FTiq6uC2P6tJ2U%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FTiq6uC2P6tJ2U%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FTiq6uC2P6tJ2U%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="171" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c92d7eccbdc23a22966c2b85f086040/href">https://medium.com/media/3c92d7eccbdc23a22966c2b85f086040/href</a></iframe><p>The first thing a VAA needs to do is figure out meaning within the speech it has process. When technologies like Siri were first starting out, this was one of the biggest barriers to overcome, specifically for one reason: human beings are super inconsistent when it comes to speech. If you’re setting a reminder on your phone, you could say “remind me to buy groceries tomorrow at 5 PM” or “please set a reminder for tomorrow at 5 PM to buy groceries”. To us, those two sentences don’t sound very different, but to a Voice-Activated Assistant, especially 7 or 8 years ago, those would be difficult to process as the same thing. Over time, VAAs were able to build up incredible amounts of data, stored on a Deep Neural Network (essentially a giant server in the cloud capable of processing that data), and use that data to interpret intent. The DNN could take in millions of phonemes, words, phrases, and sentences, and over time would grow to understand all the different ways humans say things. The more data these servers learned, the more unique a request the VAA could process, to the point where VAAs can figure out what you’re trying to say at a much higher rate of success.</p><h4>Extracting Entities</h4><p>Once the Voice-Activated Assistant understands what you’re trying to do with your words, it can move forward by taking the key parts of your command and turning them into entities. The entities are what the VAA can act on, the specific details of your statement that create a task. Kiran Krishnan’s blog on this subject helps break it down with the following diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Qu-mQYkvUQ3SQdZZC0dEEg.jpeg" /><figcaption><a href="https://chatbotsmagazine.com/how-does-alexa-skills-works-82a7e93dea04">Source</a></figcaption></figure><p>The key things to focus on here are the “invocation name” and the “utterance”. The invocation name is the entity that directs the VAA to use a particular area of functionality. In this case it’s for Alexa’s horoscope capability, but it could also be a word like “alarm”, “reminder” (if you’re asking about a specific task) or “sports”, “weather” (if you need something on the information side). The utterance is breaking it down more specifically — now that the VAA knows where to look or where to perform the task, the utterance provides the information about how to complete the task.</p><p>One cool thing that has evolved over time is the ability for VAAs to understand context. Kind of like the issues with understanding intent, in the early days you needed to include every component within your statement. Nowadays, if you say something like “set an alarm tomorrow”, your VAA will extract entities, but <em>also</em> understand that it’s missing an entity, and will ask you a follow-up question of what time to set the alarm.</p><h4>Communicating With Applications</h4><p>So now the Voice-Activated Assistant knows what you are trying to say and what it needs to do in order to complete your task — the final step it to actually do it! Once again, it all comes down to datasets. VAAs have so much information about correlating a request to a task that it knows how to delegate to different applications, regardless of it has the internal ability to process the task. For example, if you were to ask Siri a question about a movie review, the server that Siri is on doesn’t directly have that answer. However, Siri has access to the Rotten Tomatoes server, so it fires off a request there, and then presents that information back to you. The ability to seamlessly interact with outside applications and servers is crucial for VAAs to be useful, because they aren’t just for alarms and reminders, they’re for so much more!</p><p>The world of Voice-Activated Assistants keeps on growing every year, and in the next few years they could potentially become the most common way to interact with your devices. There are so many things you can do with your VAA, and know you hopefully know a little bit more about how they work!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxT0xeJpnrWC4XWblEk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxT0xeJpnrWC4XWblEk%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxT0xeJpnrWC4XWblEk%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="289" frameborder="0" scrolling="no"><a href="https://medium.com/media/875181f934d24b488127341d51c19614/href">https://medium.com/media/875181f934d24b488127341d51c19614/href</a></iframe><h4>Resources</h4><ul><li><a href="https://towardsdatascience.com/how-amazon-alexa-works-your-guide-to-natural-language-processing-ai-7506004709d3">How Amazon Alexa works? Your guide to Natural Language Processing (AI)</a></li><li><a href="https://magoosh.com/data-science/siri-work-science-behind-siri/">How Does Siri Work? The Science Behind Siri - Magoosh Data Science Blog</a></li><li><a href="https://machinelearning.apple.com/2017/10/01/hey-siri.html">Hey Siri: An On-device DNN-powered Voice Trigger for Apple&#39;s Personal Assistant - Apple</a></li><li><a href="http://www.news.ucsb.edu/2017/018092/iphone-siri-and-artificial-intelligence">The iPhone, Siri and Conversation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cc41ab106ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Vs. Angular — A Basic Breakdown]]></title>
            <link>https://medium.com/@jbmenashi/react-vs-angular-a-basic-breakdown-993653fdfbd2?source=rss-881e6825ec45------2</link>
            <guid isPermaLink="false">https://medium.com/p/993653fdfbd2</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jacob Menashi]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 17:57:04 GMT</pubDate>
            <atom:updated>2019-01-08T17:57:04.828Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Vs. Angular — A Basic Breakdown</h3><p>The Code Battle You’ve All Been Waiting For</p><figure><img alt="Image result for react angular" src="https://cdn-images-1.medium.com/proxy/0*2FNo1Wxk0kZX0QoH.png" /><figcaption>Source: medium.freecodecamp.org</figcaption></figure><p>Now that I’m a few months into my coding journey, I’ve really started to delve into the world of JavaScript. JS has been a real revelation for me, not only considering the power and adaptability of vanilla Javascript, but also just scratching the surface of what you can accomplish with the thousands of available JS libraries. I’ve written before about some of the more interesting libraries in the Ruby Language, so I wasn’t surprised to find JS also contains plenty of hidden “gems” (get it?). And of all the libraries making waves in the coding world these days, there might not be a bigger deal than React.js, which was released to the public by Facebook in 2013. React is an extremely functional and popular library for web apps, and it’s no wonder why many of the top coding bootcamps (hem hem) have it in their curriculum.</p><p>Of course React isn’t the only dancer in this tango; there are new libraries and frameworks popping up every day attempting to differentiate themselves from the pack. React’s main competitor, however, is actually a JS framework three years its senior — Angular.js, created by Google and still the front-end solution for many popular websites to this day. You can find React vs Angular arguments all over the internet, each side with its own supporters and detractors. After doing some research into both, here’s one layman’s breakdown of the two titans of JS, focusing on three main areas</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FOv5NiLVXT8JEc%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FOv5NiLVXT8JEc%2Fgiphy.gif&amp;image=http%3A%2F%2Fgiphygifs.s3.amazonaws.com%2Fmedia%2FOv5NiLVXT8JEc%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/017cd813a1cc7dd15d9710e3776bef51/href">https://medium.com/media/017cd813a1cc7dd15d9710e3776bef51/href</a></iframe><h4>Structure</h4><p>I’ve already kind of mentioned one of the biggest differences between React and Angular — React is a <em>library</em> while Angular is a <em>framework. </em>That distinction comes into play when looking at the Model-View-Controller methodology commonly used in web development. As just a library, React takes care of *only* the View portion of that system — so the developer is left to figure out what to do about the M and the C. In my case, with some Ruby on Rails knowledge at my disposal, I’ll use that to fill in those gaps, but the great thing about React is that you can kind of pick whatever you want — it’s all about freedom.</p><p>Angular, on the other hand, is a full framework, so it has the M, V, and C ready to go for you. That can be a good thing if you already know how Angular works, as you don’t have to worry about building out your framework, and you know that your MVC won’t have trouble working together. But if you aren’t experienced in Angular, the learning curve is a bit steeper, and if you don’t like Angular’s components, you’re stuck with them.</p><h4>Style</h4><p>Another major difference between the two is how you actually write the code — because it’s not just JavaScript that you need to use. Before looking into either React or Angular, I was under the impression that you’d have to use a combination of JS and HTML to get the front-end of your project working, and that’s almost true. In fact, to the naked eye, both React and Angular seem to be made up of just that, but there are subtle differences. Angular uses HTML to display elements on the page, but their JavaScript is an enhanced, bonus-feature version, technically called a “superset”, of the language called TypeScript. Likewise, React has its own syntactical version of JS, called JSX, which looks like a combo between JS and HTML, and it’s what’s used instead of HTML for that library. Though TypeScript and JSX are NOT the same thing, the important thing to know is that both React and Angular have some language quirks any developer needs to learn — but with a good background in JS and HTML, it’s relatively smooth sailing.</p><h4>Where React Pulls Ahead</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FBDagLpxFIm3SM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FBDagLpxFIm3SM%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FBDagLpxFIm3SM%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/da438b86e75ffc4a9d28fac2b39e06f4/href">https://medium.com/media/da438b86e75ffc4a9d28fac2b39e06f4/href</a></iframe><p>The big disclaimer I have to add here is that I’ve used React and Angular for a combined 3 days in my life at this point, so this opinion is certainly not set in stone. But from my research there seem to be two major advantages to React that make it the preferred front-end UI system. First, React Native, the addendum to React that allows developers to make mobile applications, is considered one of the best platforms in the game. You don’t have to know the specific languages for Android and iOS — knowing JavaScript is good enough for Native, and therefore good enough for me.</p><p>The other major separator is that React uses a Virtual DOM instead of the actual DOM to update its content. If you want to make a change to some code on Angular, the framework has to re-render the entire DOM to complete the update — which could be a huge problem when it comes to speed. With React, the Virtual DOM means that only the parts of the code that are changed need to be updated, not the whole page. It’s this factor that makes React much faster than Angular, and makes it my pick in this particular fight.</p><h4>Resources</h4><ul><li><a href="https://www.sitepoint.com/react-vs-angular/">React vs Angular: An In-depth Comparison - SitePoint</a></li><li><a href="https://programmingwithmosh.com/react/react-vs-angular/">React vs. Angular: The Complete Comparison - Programming with Mosh</a></li><li><a href="https://appinventiv.com/blog/react-vs-angular">React vs Angular: Who is winning the Battle to be the Best Js?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=993653fdfbd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>