DEV Community


Machine Learning at A Glance

overrideveloper profile image Banso D. Wisdom ・7 min read

Hi there! It's been a while since I last wrote anything. I've been really busy, so it's been difficult to write.

This article is one which I had drafted a while ago but I hadn't just gotten around to writing. It's "Machine Learning at a glance" and it aims to help demystify machine learning, make it as easy as possible to comprehend and serve as a beginner roadmap.

This article outlines stuff from my talk on the same topic at the North-Central Devfest of the Google Developer Group in Nigeria in 2017. I know, it's been a while since then, but this stuff is still relevant as I occasionally meet people who say they have interest in machine learning and artificial intelligence, but do not know how to go about it or what it entails. I hope this article helps provide some sort of insight.

Artificial Intelligence

Artificial intelligence (AI) has become a household term over the past couple of years, we see it been referred to and depicted in games, movies (remember J.A.R.V.I.S?) and in books, but what really is artificial intelligence?

AI is simply intelligence exhibited by/in machines, these machines are called intelligent machines. An intelligent machine is any device(from small devices like our smartphones to larger devices like TVs) that perceives its environment and takes action that maximizes it chances at success at some goal.

Simply put, an intelligent machine is a device that studies its environment, learns from it and adapts to changes in the environment by adjusting its actions in order to better perform specific tasks; tasks it was designed to accomplish.

Applications of Artificial Intelligence

We've all seen artificial intelligence been depicted in movies, games and books, but there are also real-world applications of artificial intelligence, some of which are:

  • Finance
  • Health care/Medicine
  • Customer service/Chatbots
  • Education
  • Transportation
  • Technology

AI of the past were limited to a few functions like error-reporting and all that basic stuff. AI of the near future is projected to be able to do much more complex stuff, and we are already seeing some of that in the present.
The question is "How do we develop AI to such a level? How do we build intelligent machines capable of complex stuff", the answer is machine learning.

Machine Learning

Compared to AI, the term "Machine learning" might not be so common or it might be, but most people don't have even the faintest idea of what it's about.

Machine learning (ML) is an approach to achieving Artificial Intelligence. That being said, we can say the goal is to develop intelligent machines and that machine learning is a way of achieving that goal.
ML deals with developing systems that learn without being explicitly told what to do, similar to how humans learn.

Traditional Programming vs Machine Learning

Traditional Programming

Traditional Programming

In traditional programming, we provide the rules and data as input and the algorithm provides us answers as output. Let me show a quick example, using simple interest.

We all know simple interest from math, yeah? And when starting out with programming, after writing the usually "hello world" program, simple arithmetic programs are usually the next thing to do; so this example should be straightforward.

Now, the formula for simple interest is (PRT)/100. Using the diagram above, we can analyse a program that calculates simple interest thus:

  • Data: The data provided as input would be the variables P, R and T.
  • Rules: The rules would be the formula SI = (PRT)/100
  • Answer: And the answer would be the variable SI

This is basically how traditional programming works.

Machine Learning

Machine Learning
In machine learning, it's way different from traditional programming. Here, we provide the data and expected answers as input and the algorithm generates rules as output.
An example is a machine learning system that differentiates between real and counterfeit bank notes. Using the diagram above, we can analyse such a system thus:

  • Data: The data provided as input would be several thousand images of both counterfeit and real banknotes.
  • Answer: The answers provided as input would be labels on these images which specify whether or not a particular image is that of a real or a counterfeit banknote.
  • Rules: The rules would then be generated by the machine learning algorithm, these rules are more or less the algorithms understanding of how it can differentiate real banknotes from the counterfeit notes.

Why should we care about Machine Learning?

I often get asked questions like "Why should I care about machine learning? Why is it suddenly important? Why now?",
Here are a following reasons why we should care about machine learning and why it's "suddenly" important:

  • Data availability: There is a lot of data being generated right now, A LOT(big data sound familiar?). This data is generated by our smart devices, embedded systems and several other sources. There is so much data now than ever before and this data can be analysed to discover patterns, trends and associations that can be used to make intelligent decisions, so why don't we do that?
  • Computing power: Current hardware have enough computing power to analyse data. We have PCs with crazy hardware, we have phones with more computing power than the computers that took man to the moon.

Between the large amount of data and devices with sufficient computing power to analyse them, I believe there is no better time to care about machine learning.

The machine learning process

The machine learning process can be defined as a sequence of steps which are:

  • Data collection: This involves sourcing of data to be used as input. Data could be in different formats: XML, JSON, CSV, text files, images, etc and can be gotten from various sources.
  • Data preparation: This involves analyzing and filtering data based on the requirements of the machine learning system to be developed and removing poor, bad and unnecessary data. This also involves splitting the prepared data into training and test sets, the training set will be used to train the algorithm and the test set will be used for validation
  • Training: This is the part of the machine learning process where the algorithm is trained using the training set.
  • Evaluation: After training, the trained model evaluated using the test set.
  • Optimization: Based on the results of the evaluation, the model can be optimized to reduce margin of error and increase efficiency. Optimization might involve tweaking a few things in the algorithm, introducing a new variable to increase efficiency or changing the entire model/algorithm completely.

Machine learning algorithms

Machine Learning Algos
There are three major classes of machine learning algorithms, they are:

  • Supervised Learning.
  • Unsupervised Learning.
  • Reinforcement Learning.

Supervised Learning

Supervised Learning is a class of machine learning algorithms that are used to build predictive models. They are "predictive models" because their aim is to predict future outcome based on historic data.
In Supervised Learning, the desired output is already known and as such data is labelled and the machine learning models are given clear instructions on what they are to learn and how they are how to learn it.

There are two main tasks/problems in supervised learning, they are:

  • Classification: This is a machine learning task/problem that deals with classifying items into categories. For example, real and counterfeit banknotes, cats and dogs, etc.
  • Regression: This is a machine learning task/problem that deals with predicting real values such as weight, money, etc. For example, predicting the price of fuel in 2023, predicting the cost of a 30-inch pizza(a 30-inch pizza would be such a sight!), predicting the amount of rainfall in 2020, etc.

See here to read a little more on Supervised Learning

Unsupervised Learning

Unsupervised Learning is a class of machine learning algorithms that are used to build descriptive models. They are "descriptive models" because their aim is to determine and define structure and similarities from unstructured and unlabelled data.
In Unsupervised Learning, the desired output is not known and as such data is unlabelled and models are not told how to learn, but must do so entirely on their own.

The major task in unsupervised learning is Clustering; a machine learning task/problem that deals with determining structure in unlabelled data.

Reinforcement Learning

Reinforcement Learning is a class of machine learning algorithms that are used to build models that use trial and error to determine which actions yield the greatest rewards. The aim of these models and reinforcement learning is to maximize rewards.
Reinforcement learning models are mostly used but not restricted to robotics, gaming and navigation.

Other machine learning algorithms include:

  • Semi-supervised learning: This uses a small amount of labelled data and a large amount of unlabelled data.
  • Active learning: Here, the model interactively queries the user to obtain new knowledge.

Resources to get you started with Machine Learning

Here are a few resources to get you started with machine learning:

  • Google's Machine Learning Crash Course: Google, being one of the big players in machine learning has a machine learning crash course designed to teach the basics of machine learning.
  • Udacity Machine Learning Nanodegree: Udacity offers an in-depth machine learning nanodegree which takes you through machine learning fundamentals and principles via projects.
  • Kaggle: Kaggle is one of the largest communities of data scientists and machine learning engineers and enthusiasts. It provides you access to a lot of datasets and the opportunity to explore and build models, learn and also participate in machine learning and data science competitions.
  • scikit-learn: sci-kit learn is an open source machine library in Python. It provides simple and accessible tools for data analysis and building machine learning models. It has an easy learning and I recommend using it for beginner-level stuff.
  • Zindi: Zindi is an African community of data scientists and machine learning engineers and enthusiasts. Zindi provides access to data sets sourced from Africa as well as the opportunity to participate in data science competitions.

Now is the time to get involved in machine learning and I hope this gives an insightful overview of what machine learning is and helps you get started. Good luck, and keep on learning!


Editor guide
s3artis profile image
Matt Weingaertner

Thanks, a really nice written overview.

overrideveloper profile image