A Gentle Introduction To Machine Learning (And Data Science)
Lede
What is Machine Learning & Data Science? As industries have evolved and began to adapt methods of improving efficiency & time management while simultaneously remaining budget conscious, these are topics that have begun to echo throughout them more and more as the landscape evolves.
Throughout this article, we are going to explore the fundamentals of these topics, the foundations they’re built on, how it fits into the tech space and how it’s evolving to benefit a growing number of varying industries.
Machines, or more simply put computers in this case, are very good at performing tasks at a high speed. We can utilize this through directing them by giving them a list of instructions & rules for them, in order to perform specific tasks for us. This on a fundamental level is what programming is.
The term ‘computer’ originates from the early 17th century as a term used for people who’s livelihood involved working with calculations, for example, an accountant. Computer was originally an abbreviation of the term “one who computes” a person performing mathematical calculations, before electronic computers became commercially available.
So imagine you’ve been given a task to calculate the distance between multiple routes to the same destination to identify the most efficient path before a journey. You could manually break out a map, do some math and break down the shortest path by gathering data, comparing each option and weighing them against each other.
Alternatively, you could input each route into a computer and instruct it to calculate the distance between 10 alternate routes and tell you the shortest one.
So following an initial investment in completing the programming stage where you have given the machine a list of instructions & rules, instead of spending large quantities of time open to human error to find your result, you can then just submit a request, click a button and the application will identify the data presented, know what to do with each component and you will receive your solution instantaneously for any relevant task going forward.
An example of this type of model you’ve likely used in your daily life is present in applications like ‘Citymapper’ or ‘Google Maps.
So, where does ‘learning’ come into this?
What if instead of having your machine follow a list of pre-set instructions, you require it to take initiative, starting with being able to identify something that doesn’t necessarily fall under grammatical or numerical data. Like pinpointing elements in images, videos and even audio for example.
For example what if you require your machine to identify a dog, how would you explain to a computer what a dog is? How do you instruct a computer to identify if a picture, video or audio file is a dog or not? You can attempt to input instructions to identify if it has fur, however the response from the computer will simply be “fur is an invalid input”.
Remember, although computers are very good at performing tasks at a high speed until they receive instruction & data, initially, they have no knowledge of anything. The harder something is to describe, the more complex it is to instruct a computer to identify & perform it, so typically computers were only given simple tasks and the more complex ones were given to people to perform manually.
This is where the concept of machine learning was constructed. The invention of machine learning has an ever-growing list of applications to which it can be applied to, whether it be self-driving cars, AI (artificial Intelligence), visual language & audio processing, analytical & recommendation services, translation services and the list goes on. This in turn extends to a wide variety of industries stretching as far as marketing to the medical field and even the stock markets.
The idea of machine learning is simply to train machines to develop an architecture that models it’s development after human brain functions in order to have them act more and more like humans to go from helping us perform simple tasks to ones that are much more complicated both in premise & scale in an effort to improve speed, efficiency and reduce cost.
We can teach a machine to identify something by inputting a large number of examples into a categorisation in order to train it, creating a model based architecture for that specific task, first on a general scale, then down to more minute details. This can be anything from pictures to audio and video. The more examples the machine has to identify both in volume and variety, the more intelligent it becomes towards identifying its unique features when presented with it.
Try it yourself
The best way to gain an understanding of anything is to get hands on experience following theory & demonstration. Considering this, I have provided a tool developed by Google that will allow you to train your own machine learning application in minutes without requiring the use of a programming language. The article will walk you through the process regardless so this is purely optional.
The software creates a simple machine learning model by allowing you to categorise sections and input whatever you want into it, whether it be images, video, audio or your own movements repeated on a live feed/webcam. The more you train it (the more examples you give it), the more accurate it will become in identifying what you’re training it to categorise.
The resource used for this example has been linked below:
https://teachablemachine.withgoogle.com/
To keep it simple, we are just going to build a model that will both identify and be able to differentiate the human face and a dog.
In the example below I submitted 5 examples of dogs and human faces before training the model. Based on this when submitting a clear shot of a unique face the machine was able to check examples in both of it’s now trained categories and identify that it was a human face with 100% certainty after previously having no knowledge of either.
This was successful after only 5 images, so imagine the accuracy it would have when given hundreds, thousands, hundreds of thousands or even millions of varying examples.
This is what companies like Google & Apple are doing to develop software like Face ID to unlock your phone, which has been trained so thoroughly, it identifies the most minute details of your face once scanned to differentiate yours from anyone else’s and only give a perfect match access to your phone.
Under the Hood
AI, Deep Learning and Data Science:
What is the relation and how closely do they work together?
So now that we have a fundamental understanding of Machine learning, whenever this topics comes up you will often be presented with a few separate topics, including: data science, AI, neural networks and deep learning. So what do they mean and how do they relate to machine learning?
AI: Everything starts with AI or ‘Artificial intelligence’, which simply means a human intelligence replicated by a machine, so essentially a machine trained to behave like a human. There are two categories under this umbrella. The most popular forms are:
Narrow AI which is trained to perform a specific task to the level of or even better than a human but is limited to that performing that one function very efficiently.
General AI is the same principle with the difference being that it’s developed to perform multiple tasks.
Machine learning is a subsection of AI that attempts to achieve artificial intelligence by recognising patterns within data it’s provided with. Once set up the idea is the machine will be able to act on it’s own accord without being directly controlled and instructed by a user on each step.
Deep Learning: Deep learning (also known as ‘Deep Neural Networks’) is a method of implementing machine learning. It is an algorithm that teaches a machine to do what comes naturally to humans by learning through example. For example this is the key element used to develop self driving cars by programming it to know when to say stop at a stop sign, go at a green light and to hit the brakes when a pedestrian or inanimate object is identified in it’s path.
Data Science: Data Science in simple terms is the process of analysing data and doing something with it. Data science and machine learning are not mutually exclusive, meaning to be good at and have an understand of one, you need to also understand the other.
When you see job descriptions for each there usually isn’t much of a clear distinction between a machine learning expert and a data science expert. Data science or data analysis is looking at & breaking down sets of data to gain an understanding of it by comparing it to different examples. Machine learning is taking that data while finding actionable things within it.
Types of Machine learning
supervised learning, unsupervised learning, and reinforcement learning.
Machine learning is about predicting results based on incoming data. So under the hood what are the building blocks that machine learning uses and how are they implemented?
The three most important categories in machine learning are: Supervised, unsupervised and reinforcement learning.
Supervised learning: Supervised data is delivered with structure and indexing in place, think of it as an Excel sheet with rows and columns which are labelled and can be navigated through accordingly. This generally consists of labelled data and test data which tells us whether our function is right or wrong.
So in supervised learning data can be presented as a classification which essentially draws a line between results and separates them into their respective sections. So for example if you’re comparing apples to oranges, the model will draw a line and identify each input through unique features, patterns & trends and decide which side it belongs to.
Or we can do something called regression which makes predictions based on inputs. So for example a model used in the medical field to identify the likelihood a patient has a certain health condition would compile inputs based on the patients list of physical traits, age, weight etc, symptoms, images & scans, their current, past and family health records to name a few and make a prediction on how closely those factors match the condition in question.
Unsupervised learning
Sometimes data is presented without labels, this is called unsupervised learning. Think of it again as an Excel sheet but without the column name labels.
Clustering: is a method where we or rather the machine creates these groups by recognising repeating data points and patterns and determining which items match which group.
Association rule learning: This is where we associate different things to make predictions. For example when shopping online on Amazon, the site will look at items & patterns related to them that you and users with similar interests buy, search and browse for and it will make predictions on what to suggest that you may be interested in buying in the future.
When groups don’t exist initially, we call it unsupervised learning. We can’t tell machines they are right or wrong because there are no categories so we first let the machines identify unique qualities to create these categories without our input.
Reinforcement learning: Finally we have reinforcement learning. This method is quite interesting because it revolves around teaching machines through trial and error, rewards and punishment.
For example if a program is taught to play a videogame like the classic ‘Breakout’, initially it doesn’t know what it’s doing, however it knows it’s objective is to maximize the score and avoid failure/punishment. So it will start to experiment and discover what components each result entails and how to achieve & prevent them respectively through trial & error.
It will play or simulate this to itself at a high speed repeatedly as many times as required until it eventually figures out a punishment is caused when the ball goes under the line. It will soon discover that this is prevented when the paddle making contact with the ball. Following this it will soon hit a brick and score a point (reward). The foundational structures are now in place for it to play on it’s own without the need for human input.
Topics like neural networks, decision trees and support vector machines for example are algorithms built using these sub fields in order to come to utilise the data it receives and make predictions based on them.
Recap:
What is Machine Learning?
To summarise:
Machine learning is the process of creating an algorithm or computer program to discover & identify different patterns in data, it then takes that algorithm and uses it to calculate accurate answers & make predictions when presented with similar data using the foundations built from the former.
It applies this to models that are trained to do a specific task. These models are trained through a series of categorisations, data, examples and patterns. It then repeats the process as many times as required, using a trial & error based reward & punishment system until the optimal output for the objective has been consistently reached.
Machine Learning is used in tandem with Data Science aka Data Analysis in order to take the broken down & categorised data provided to run a series of tests & experiments on it in order to provide actionable insights within it, which is used in order to develop a machine learning model as a self sufficient tool that can be applied to benefit an ever growing list of tasks and industries.