The first things you need to know about machine learning

Written by salma_ghoneim | Published 2019/03/11
Tech Story Tags: machine-learning | data-science | technology | tech | about-machine-learning

TLDRvia the TL;DR App

Get initiated into the machine learning world now!

Everyone is talking about Machine Learning. Those who are in the business of fields related to computers and those who aren’t.It has become a new trend. It has become one of the words that make you sound intelligent. My curiosity has driven me to learn about it. At first, just for the sake of having something to say when the topic is brought up. However, after I have learned a bit about it. I was impressed. And I hope you do too after reading this article. I will write to you the basics with which you will get an idea about machine learning. If you find yourself interested then that’s a sign that you should dive into the topic more!

Let me guide you through the non-technical aspect first.

We will work our way with an example.

sketch made using sketchboard

Let’s say that our friend Sara here loves reading. She signs up for an app where she can buy some books online. During sign up, she checked the box that said: “I prefer quick reads”. After that, the app started to recommend some books to her. She liked & bought some (green) and disliked others (red). After a couple of months, the app recorded the following:

sketch made using sketchboard

Now, There are 2 scenarios for the app’s recommendation system:

  • If this app was using traditional if-else statements. It wouldn’t change anything about its recommendation system. It might as well not save this data. Unfortunately, it would continue to recommend short reads to Sara although she obviously does not want that.

## A sample of an old-fashioned code

if(sara.preferes_good_reads && new_book.number_of_pages < 300):sara.recommendation_list.add(new_book)

  • If this app was smart, It would recognize this pattern using machine learning algorithms and would alter its recommendation system to be more suited to her needs. It would know that Sara has changed her mind about quick reading and that she now prefers big books. More importantly & what’s impressive is that it would figure out that Sara bears in mind the book reviews before buying any book.

sketch made using sketchboard

Now the app just received 3 new books. A yellow, purple and a gray book.What would a smart app recommend ?! Disqualifying the gray book & recommending the yellow one seems like the logical thing to do. We can safely say that there is a very high probability that Sara would not like the gray book and that she will love the yellow one.What about the purple book though? That is where machine learning proves it’s usefulness. Just by looking we were able to solve the more obvious problems, but it is not always that easy. Here we’re only considering 2 factors (Number of the book’s pages & its reviews). Factors like the cover page, title, book quality, reviews on the author, referrals, price, genre, etc. have not been added to our equation yet, making our problem a million times harder. A problem that is impossible for humans alone to solve.

This is a simple representation of the complex problems that Machine Learning helps us solve. There are million other fields in which Machine Learning is breaking through.I am currently working on a project where machine learning is used to take a look at an MRI scan and detect whether this person has a tumor or not, pretty impressive, huh?! Not easy though.

Machine Learning in a nutshell

Machine learning is the study of algorithms and mathematical models that are used to solve a problem without being explicitly told what to do. Machine Learning programs rely on intelligent detection of patterns & connections in existing data to predict the solutions of problems that the program may have never seen before.

Machine learning is able to see what humans can not. It is able to calculate how much Sara takes into account how big the book is vs the book reviews. So when a book in an unclear area appears. It is able to estimate the weight of each factor based on Sara’s history, then applies these estimates on the current new book and predicts whether she will like it or not.

Now get comfortable for some technicalities.

Photo by Nicole Honeywill on Unsplash

There are 4 main types of Machine Learning Systems mostly classified according to the amount and type of supervision they get during training:- Supervised Learning- Unsupervised Learning- Semi-supervised Learning- Reinforcement Learning

The following is pretty much a summary of chapter 1 from a great book that I recommend Hands-On Machine Learning with Scikit-Learn & TensorFlow by Aurélien Géron.

Important notes: Usually when you’re using Machine Learning to predict a label (label is the desired solution to the problem, Should we recommend this book to Sara? yes/no), you use a dataset (a collection of data).You divide it into a training set and a test set. You use the training set to train your machine learning program with until you reach a good accuracy (accuracy is how you measure how close your program correctly predicts the labels).You use the test set to test how your program deals with new data that it has never seen before.More often than not, the test set accuracy is lower than the training set accuracy. The test set accuracy is what you should expect your program to have once you launch it online.

Let’s take a quick look at the 4 types of Machine Learning Systems:

  • **Supervised Learning**In supervised learning, the training set is labeled, the program learns the connection between the data and its labels.The most basic supervised learning tasks are Classification & Regression.Classification problems decide whether X belongs to a set or not.Will Sara like the book? Yes or No?Is this email spam? Yes or No?Regression problems predict a value from a continuous set of information.How much will this jacket cost?

  • **Unsupervised Learning**As you might have guessed. The dataset is unlabeled, the program tries to learn without a teacher.An example of Unsupervised learning tasks is Clustering.Clustering problems divide the data into groups of similar subjects.for example, I may be interested to know that 40% of my readers are male, 70% are 30+ years & 10% are shorter than 60 inches.You don’t tell your program which reader belongs to which group, it figures all these factors & similarities on its own.

  • **Semi-supervised Learning**The dataset is partially labeled. Typically, the smaller portion is the labeled one.You will relate to this one, you know how iPhone photos app has this “people” albums, in which it clusters people that look alike and pick a representative from each cluster and asks you about their name (label). Then the photos app labels those who look like this person and puts them in the same cluster.

  • **Reinforcement Learning**The learning system is very different here. It is called the agent. The environment is observed by this agent, the agent performs an action for which he either receives a penalty or a reward and that is how the agent learns. Kind of like a toddler when he/she touches fire for the first time, they are hurt so they do not go near fire again.

photo from pexels

As the book Machine Learning with Scikit-Learn & TensorFlow _by Aurélien Géron. says_To summarize,Machine Learning is great for: - Problems for which existing solutions require a lot of hand-tuning or long lists of rules: one Machine Learning algorithm can often simplify code and perform better.- Complex problems for which there is no good solution at all using a traditional approach: the best Machine Learning techniques can find a solution.- Fluctuating environments: a Machine Learning system can adapt to new data. Getting insights about complex problems and large amounts of data.

I hope this has made you understand more about Machine learning. I am sure that when you dive into it more you will love it more_._


Published by HackerNoon on 2019/03/11