Introduction

Machine Learning - is a subdomain of Computer Science that focuses on algorithms which help a computer learn from data without (a programmer being there telling what to do) also known as explicit programming. Most of machine learning deals with Arrays which is a collection of data as seen in the example below:

myArray = [99,86,87,88,111,86,103,87,94,78,77,85,86]

Differentiation

What's the difference between Artificial Intelligence, Machine Learning and Data Science?

Types

There are 3 types in Machine Learning: Supervised Learning, Unsupervised Learning and Reinforcement Learning.

Supervised Learning

Uses labeled inputs (meaning the input has a corresponding output label) to train models and learn outputs. To a computer, pictures are just pixels with colors, there is really no “learning” going on. When we attach “labels” to these pixels, the computer is learning based on images to depict what a picture signifies. Below is an example line of code using scikit-learn in Python

from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X_train, y_train)

Unsupervised Learning

Uses unlabeled data to learn about patterns in data. again, to a computer, all images are just pixels with colors, there is really no “learning” going on. but when we feed all a lot of images to a computer, it will start clustering these images based on the pattern it sees such as what is in common with these various images. Below is an example of a simple unsupervised learning code using scikit-learn in Python, specifically for training a K-means clustering model:

model.fit(X)

Reinforcement Learning

Machine/agent learning in an interactive environment based on rewards and penalties.

Below is an example of a single line of code for reinforcement learning using the OpenAI Gym library, specifically for taking an action in an environment:

observation, reward, done, info = env.step(action)