Introduction to Machine Learning

Prakhar Patel
7 min readDec 31, 2021

“Computers are able to see, hear and learn. Welcome to the future.”

Definition :

  • Machine Learning is a study of various types of algorithms of Artificial Intelligence that enabled self-learning from data without explicitly programmed.
  • With this technology, computers can learn by themselves and improve their accuracy and experience over a period of time.

Purpose :

  • The primary goal of ML is to observe the given problem or a dataset and determine the hidden patterns and relationships and extract details/information which helps in data-driven decision making and provides insights.

Any dataset has some terminologies that help us while choosing an appropriate ML model.

There are mainly three types of learnings:

  1. Supervised Learning
  2. Unsupervised Learning
  3. Reinforcement Learning

Supervised Learning :

  • A type of machine learning called supervised learning uses pre-labeled data to train a machines or models, which predicts the output based on the labelled data. Labeled data means that the input data can already be tagged with the desired output.
  • When a given dataset has features, observations, and responses, this type of ML(Supervised) becomes more accurate and effective. Supervised Learning can also be described as task-oriented learning. These types of algorithms predict the output for a given new data/input.
  • With supervised learning, the goal is to find the mapping function that maps the input variables (x) to the output variables (y).
  • The real-world applications of supervised learning include risk assessment, image classification, fraud detection, spam filtering, and others.

Working:

Image from javatpoint.com

Example:

Suppose we have a dataset that contains the number of hours of student study as well as corresponding percentages they have got. So, we can say that we are given input/features(Hours) and output/label/response(Percentage).

Which means we can train our model by hours and percentage. For testing purposes, we can take new data as an input and check the corresponding output and determine whether it is accurate or not.

Supervised ML can also be further categorized into two group

  1. Regression (It is used when data is continuous):
    It is an optimal method to distinguish the relationship between a dependent and one or more dependent variables.
  2. Classification (It is used when data is categorical):
    It is a Supervised Learning technique that is used to determine the class of new observations on the basis of training data.
    It predicts categorical labels also called classes or categories.

Steps involved in Supervised Learning:

  1. Determine the type of training dataset or identify the domain of problem.
  2. Collect the data according to your requirement that must be correlate with domain you have chosen.
  3. Split the gathered data into training data, test data and validation data.
  4. Determine the input features of the training dataset, which must have appropriate knowledge so that model can accurately predict the relevant output.
  5. Select suitable algorithm for your problem and your data.
  6. Apply the algorithm to the training dataset. Sometimes, validation sets are needed as control parameters.
  7. The test set should be used to determine the accuracy of the model.

Supervised Learning algorithms:

  • Linear Regression
  • Logistic Regression
  • Decision Tree
  • SVM(Support Vector Machine)
  • Naive Bayes
  • K-nearest neighbors
  • K-means
  • Random Forest
  • Dimensionality Reduction Algorithms
  • Gradient Boosting Algorithms

Generalization refers to your model’s ability to adapt properly to new, previously unseen data, drawn from the same distribution as the one used to create the model.

Unsupervised Learning :

  • This is a type of machine learning in which models are trained using the unlabeled dataset like images, audio, videos, x-rays, etc.
  • It is an optimal ML technique in which the user does not need to supervise the model, instead, it allows the model to work on and discover patterns that’s why it is termed as self-organized learning.
  • Unsupervised Learning performs the more complex tasks as compared to supervised learning but there is always a problem of the unpredictability of the model.
  • The primary goal of Unsupervised Learning is to find the structure of data and group them according to their similarities and associativity and represent data into a more compressed format.

“Unsupervised learning is a type of machine learning in which models are trained using unlabeled dataset and are allowed to act on that data without any supervision.”

Working:

Image from javatpoint.com

Unsupervised ML can also be further categorized into two group

  1. Clustering:
    A simple way of grouping the data points into various clusters. The objects or points having similarities remain in a group.
  2. Association:
    Association rules allow you to institute associations amongst data objects inside large datasets. This unsupervised method is about discovering interesting relationships between variables in large datasets. For example, people that buy a new car are most likely to buy insurance.

Unsupervised Learning algorithms:

  • K-means clustering
  • KNN (k-nearest neighbors)
  • Neural Networks
  • Apriori algorithm
  • Hierarchal clustering
  • Anomaly detection
  • Independent Component Analysis
  • Principle Component Analysis

Reinforcement Learning :

  • It is a feed-back based machine learning technique in which agent learns to behave in an environment by performing the actions and seeing the results of actions. For good action agent gets positive feedback and for dull action agent gets negative feedback or penalty.
  • In reinforcement learning the agent learns automatically using feedbacks without any labeled data unlike supervised learning. Agent interacts directly with the environment and explore it by itself.
  • The main purpose of the reinforcement learning is to improve the accuracy and performance by getting maximum positive feedbacks or rewards.

“Reinforcement Learning is a type of machine learning method where an intelligent agent or computer program interact with the environment and learn to act within that”.

  • Feedback that agent gets after performing an action from the environment is called “Reward Signal”. Reinforcement learning (RL) deals with the ability of learning the associations between stimuli, actions, and the occurrence of pleasant events, called rewards, or unpleasant events called punishments.

Terms used in Reinforcement Learning

  • Agent(): An entity that can perceive the environment and act upon it.
  • Environment(): A situation in which an agent is present or surrounded by.
  • Action(): Actions are the activities taken by an agent within the environment.
  • State(): State is a situation returned by the environment after each action taken by the agent.
  • Reward(): A feedback returned to the agent from the environment to evaluate the action of the agent.
  • Policy(): Policy is a strategy applied by the agent for the next action based on the current state.
  • Value(): It is expected long-term retuned with the discount factor and opposite to the short-term reward.
  • Q-value(): It is mostly similar to the value, but it takes one additional parameter as a current action (a).

Elements of Reinforcement Learning

  1. Policy
    A policy can be defined as a way how an agent behaves at a given time. Policy is a core element of the RL, since it is the only thing that defines how the agent behaves.
  2. Reward Function/Signal
    As the learning agent moves from one state to the next, the environment sends an immediate signal called a reward signal. Agents are rewarded depending on their good or bad behavior.
  3. Value Function
    The value function provides information about the situation and the agent’s actions, as well as how much reward an agent is likely to receive. Reward functions indicate the immediate signal of each good or bad action, while value functions describe future states and actions.
  4. Model
    Reinforcement learning also involves the model, which mimics the behavior of the environment. The model is used for organizing, which means it provides a method to take a course of action by considering all future situations before actually experiencing those situations.

Applications of Reinforcement Learning

  1. Self-driving vehicles
  2. industry Automation
  3. Finance Sector
  4. Healthcare domain
  5. News Recommendation System
  6. Image Processing

Example
A mobile trash collecting robot decides whether it should enter a new room in search of more trash to collect or start to find a way to get back to it battery recharge station. This decision is made based on how quickly and easily it has been able to find the recharge in past. This can be done by reinforcement learning algorithm.

Applications of Machine Learning

  1. Image and Speech recognition.
  2. Product Recommendation.
  3. Sentiment Analysis.
  4. Language Translation.
  5. Chatbots(Virtual Person Assistants).
  6. Fraud, spam emails Detection.
  7. Sorting, tagging, categorizing photos.
  8. Enabling business intelligence.
  9. Medical Diagnosis.
  10. Self-driving Vehicles.

Thanks for Reading

If you like my work and want to support me…

  1. The BEST way to support me is by following me on Medium here.
  2. Follow me on GitHub here.
  3. Follow me on LinkedIn here.
  4. Be one of the FIRST to follow me on Instagram here.

--

--

Prakhar Patel

Hello, I’m a computer student passionate about data science. I believe the best way to broaden our knowledge is to share it with people.