Machine Learning for Beginners: 7 Easy Steps to Get Started

Machine Learning for Beginners – Concepts, Algorithms and Projects

What is machine learning?

Machine learning refers to a computer science discipline that gives computers the ability to learn from data and not from a list of fixed rules.
The concept dates back to 1959, when IBM researcher Arthur Samuel developed a computer program that taught itself to play checkers. The more games it played, the better it got, until it could beat the programmer. Samuel is frequently credited with popularizing the term machine learning, and the idea associated with his work remains the simplest way to explain it: machine learning allows computers to learn without being explicitly programmed.

Traditional programming vs ML

Suppose you want to build a spam filter for your e-mail.

  • Traditional programming: you write the rules Mark as spam if email contains words such as free, winner or lottery. That’s exactly what a computer does. However if a real payment receipt has the word payment in it, it can end up in spam, and the program cannot learn from such mistake.
  • Machine learning: You provide the computer with thousands of emails already marked as spam or not spam. It studies them, finds patterns by itself and builds a model. When a new email arrives, the model predicts whether it is spam. If it makes mistakes you can retrain it on more examples . And it improves with time .

So, long story short:

  • Classic programming Rules + Data = Answer
  • Machine learning: Data + Answers=Rules (Model)

Examples You Use Daily

  • YouTube and Netflix suggest videos based on what you have previously watched.
  • Google Maps estimates traffic and suggests the fastest route.
  • Your phone’s face unlock recognizes your face, even when you’re wearing glasses or in low light.
  • Online shopping sites show you products that you are most likely to buy next.

Some of the programming languages you may use to implement machine learning include R, Java, Scala, C++, Julia and JavaScript. R is a language and environment for statistical computing and graphics. Java and Scala are used for large enterprise systems. C++ is used for high-performance models. Julia is a high-level, high-performance programming language for technical computing. JavaScript can be used to run machine learning algorithms in the web using TensorFlow.js. For newbies, nevertheless, Python is your best bet.The syntax is simple and almost all important machine learning libraries (NumPy, Pandas, scikit-learn, TensorFlow and PyTorch) are built for Python. Python is used in most machine learning tutorials, courses and real-world projects.

Step 1: Learn the basics of Python

Python is the most popular language used in machine learning, so it’s the best place to start. You don’t need to be a Python guru to start. Just get the basics you will use all the time down:

• Variables and data types
• Conditions (if, else) and loops (for, while)
• Function
• Tuples, lists and dictionaries
• Read and write files
• Import and use libraries

When you can write small programs, and you understand what your code is doing, you’re ready to move on to the next step. If you are a beginner then our Python Tutorial for Beginners covers all these topics in a step by step manner.

Step 2: Understand Basic Mathematics and Statistics

You don’t need a mathematical degree to begin with machine learning.You just need to understand a few core topics and why they are used. You can go deeper later.

Linear Algebra

Machine learning data is stored as numbers in rows and columns. Learn vectors, matrices and basic operations like addition, multiplication and transpose. For example,A dataset of 1,000 houses with their size, rooms and price is just a matrix to a model Linear algebra also powers image recognition and recommendation systems on YouTube or Netflix.

Calculus

Calculus explains how a model learns. It makes a prediction, checks its error, and adjusts itself to reduce that error, again and again. Learn derivatives, partial derivatives, gradients and finding minimum and maximum values. These power gradient descent, the most common way to train models.

Probability

Predictions always involve some uncertainty. Learn basic and conditional probability, Bayes’ theorem and common probability distributions. For example, a spam filter says an email is 92% likely to be spam.

Statistics

Statistics helps you understand your data before building anything.

Descriptive statistics summarise your data:

  • Mean, median and mode
  • Range, variance and standard deviation
  • Normal distribution

Inferential statistics draw conclusions about a large group from a small sample:

  • Sampling and estimation
  • Hypothesis testing
  • Correlation, such as study hours vs exam marks
  • Regression, also one of the first ML algorithms you’ll learn

Step 3: Data Handling with NumPy and Pandas

Machine learning refers to data-driven and real world data is seldom clean. It often contains missing values, duplicate rows and wrong formats. Before training any model, you need to properly prepare your data.

There are two Python libraries that make this easy:

  • NumPy: for fast numeric computation and working with arrays of numbers
  • Pandas: Loading, exploring, cleaning and organizing data in tables, very much like a spreadsheet inside Python

Learn to read CSV and Excel files, deal with missing values, drop duplicates, filter rows, group data and create new columns using Pandas.

Data preparation may not sound exciting but it takes most of the time in a real machine learning project. The cleaner your data, the better your model will be.

Step 4: Visualizing Data with Matplotlib and Seaborn

Figures in a table don’t always tell you very much. Simple charts can show patterns, trends and problems in seconds.

  • Matplotlib: the fundamental Python library for creating line charts, bar charts, histograms and scatter plots
  • Seaborn: built on top of Matplotlib, it offers attractive and clean statistical plots with less code

By visualizing the data you can answer important questions before you build the model. Is the data balanced ? Are there any strange values (outliers) that could confuse the model? What are the features that go along with the prediction you want to make?

Exploratory Data Analysis (EDA) is the process of visually and quantitatively examining data. This is a habit of all good machine learning practitioners before training any model.

Step 5: Learn Core ML Concepts

There are mainly three types of machine learning. Everyone learns in different ways.

Supervised Learning

In supervised learning the model learns from labeled data, i.e. each example already contains the correct answer. It looks at these examples and learns how to predict the answer for new data.
You give a model thousands of emails marked spam or not spam. It learns those patterns, and can tell you if a new email is spam. Another common example is prediction of house prices depending on size and location.

Supervised Learning Process

Unsupervised Learning

Unsupervised learning does not use labels in the data. The model attempts to identify hidden patterns and group similar items on its own.
An online shop provides a model of its customers’ purchase history. The model clusters customers with similar habits without being told anything like budget buyers or frequent shoppers.

Unsupervised Learning Process

Reinforcement Learning

In reinforcement learning the model learns by trial and error. It takes actions, gets a reward for good actions and a penalty for bad ones, and learns slowly the best way to reach its goal.
For example, a game-playing AI will continue gaming, finding out which moves win, and improving each time. The same idea is used in self-driving cars and robots.

Reinforcement Learning Process

Step 6: Understand Popular ML Algorithms

An algorithm is the way that a model learns from data. You don’t have to learn all the algos. Begin with the most common and learn when to use each:

  • LinearRegression:predicts a number, like house price or exam score.
  • Logistic Regression: predicts a category, spam or not spam, pass or fail.
  • Decision Tree: predicts by asking a series of yes/no questions
  • Random Forest: a mixture of many decision tree models for more precise results
  • K-Nearest Neighbors (KNN): classifies new data based on closest examples
  • K-Means Clustering: clusters similar data points together without labels
    All these algorithms are usable with just a few lines of code with Python’s scikit-learn library. Don’t memorize the maths behind it, focus on what each algorithm does and where it works best.

Step 7: Work on Real-World Projects

You can read and watch tutorials, but that can only take you so far. That’s where real learning happens, when you build something yourself, make mistakes and then work out how to fix them.
Beginner projects to try first:
• Using Linear Regression for House Price Prediction
• Logistic Regression for Spam email detection
• Titanic survival prediction, a classic beginner data set
• K-Means Clustering for Customer Segmentation
• User ratings-based movie recommendation system

Kaggle and the UCI Machine Learning Repository provide free datasets. For each project you have to go through the complete process: load the data, clean the data, explore the data with charts, train a model, test it and try to improve the results.
Upload your completed projects to Github. A handful of real projects will demonstrate your skills a lot better than a list of certificates.

What To Read Next
Once you’ve got these seven steps down, you can move on to more advanced territory:
• Deep Learning: neural networks using Tensorflow / Pytorch
• Natural Language Processing (NLP): working with text, chatbots
• Computer Vision – teaching computers to see pictures and videos

Last Thoughts
In machine learning, it is not about learning everything at once. It’s all about following the right order and practicing as you go. Start with Python, build your maths and data skills, and then move onto concepts, algorithms and projects. Take it one step at a time, keep adding to it, and you’ll be amazed at how far you can go.