Chapter 1: Intro to Machine Learning
By Misganu T.
      What is Machine learning?
• Machine learning is a subset of Artificial Intelligence (AI)
  which provides machines the ability to learn
  automatically & improve from experience without being
  explicitly programmed to do so.
• In the sense, it is the practice of getting Machines to solve
  problems by gaining the ability to think.
• A computer program is said to learn from experience E
  with respect to some class of tasks T and performance
  measure P if its performance at tasks in T, as measured
  by P, improves with experience E.
• If you feed a machine a good amount of data, it will learn
  how to interpret, process and analyze this data by using
  Machine Learning Algorithms, in order to solve real-
  world problems.
   Machine Learning Terminologies
• Algorithm: A Machine Learning algorithm is a set of
  rules and statistical techniques used to learn patterns from
  data and draw significant information from it. It is the
  logic behind a Machine Learning model.
• Model: A model is the main component of Machine
  Learning. A model is trained by using a Machine Learning
  Algorithm. An algorithm maps all the decisions that a
  model is supposed to take based on the given input, in
  order to get the correct output.
        Machine Learning Terminologies Cont.
•   Predictor Variable: It is a feature(s) of the data that can be used
    to predict the output.
•   Response Variable: It is the feature or the output variable that
    needs to be predicted by using the predictor variable(s).
•   Training Data: The Machine Learning model is built using the
    training data. The training data helps the model to identify key
    trends and patterns essential to predict the output.
•   Testing Data: After the model is trained, it must be tested to
    evaluate how accurately it can predict an outcome. This is done by
    the testing data set.
    History and relationships to other fields
•   The roots of machine learning can be traced back to the mid-20th century when researchers
    first began exploring the idea of building machines that could learn from data.
•   In the 1950s and 1960s, researchers developed the first machine learning algorithms and
    models, such as the perceptron algorithm and the decision tree, and applied them to a range of
    problems, including pattern recognition, speech recognition, and game playing.
•   In the 1970s and 1980s, machine learning research slowed down due to a lack of data and
    computing power.
•   However, with the advent of the internet and the explosion of digital data in the 1990s and
    2000s, machine learning experienced a resurgence, and researchers developed new algorithms
    and models that could handle large-scale data sets, such as deep learning neural networks.
•   Today, machine learning is used in many real-world applications, including image and speech
    recognition, natural language processing, recommender systems, and predictive analytics.
•   It is closely related to several other fields, including: Computer Science, Mathematics,
    statistics, probability theory etc.
Essential math and statistics for machine
                learning
•   Linear algebra: Linear algebra deals with mathematical operations on vectors and
    matrices. It is used in machine learning for tasks such as matrix operations, vector
    operations, and solving systems of linear equations.
•   Calculus: Calculus deals with the study of how things change. It includes concepts such as
    derivatives (which measure the rate of change of a function) and integrals (which measure
    the area under a curve). Calculus is used in machine learning for tasks such as optimization
    and calculating gradients.
•   Probability theory: Probability theory deals with the study of randomness and uncertainty.
    It includes concepts such as probability distributions (which describe the likelihood of
    different outcomes), and conditional probability (P(A|B) = P(B|A) * P(A) / P(B)).
    Probability theory is used in machine learning for tasks such as statistical inference,
    generative models, and decision making.
                                     Cont. …
•   Statistics: Statistics deals with the collection, analysis, and interpretation of data. It
    includes concepts such as descriptive statistics (which summarize and describe data),
    hypothesis testing (which is used to make inferences about populations based on
    sample data), and regression analysis (which is used to model the relationship
    between variables). Statistics is used in machine learning for tasks such as data
    analysis, statistical inference, and model evaluation.
•   Information theory: Information theory deals with the quantification, It includes
    concepts such as entropy (which measures the uncertainty of a random variable),
    mutual information (which measures the amount of information shared by two
    random variables), and the Kullback-Leibler divergence (which measures the
    difference between two probability distributions). Information theory is used in
    machine learning for tasks such as feature selection, data compression, and data
                                    Cont. …
•   Optimization: Optimization is the process of finding the best solution to a problem. It
    includes concepts such as gradient descent (which is used to find the minimum of a
    function) and stochastic gradient descent (which is a variation of gradient descent that
    uses a random subset of data to estimate the gradient). Optimization is used in machine
    learning for tasks such as finding the best model parameters and minimizing the loss
    function.
•   Graph theory: Graph theory deals with the study of networks and connectivity. It
    includes concepts such as graphs (which are mathematical structures that model
    relationships between objects), nodes (which are the objects in a graph), edges (which
    are the connections between objects in a graph), and centrality (which measures the
    importance of nodes in a graph). Graph theory is used in machine learning for tasks such
    as clustering, community detection, and network analysis.
         Applications of machine learning
Machine learning has a wide range of applications across different industries and fields.
Here are some examples:
•   Image and Speech Recognition: Machine learning is used to recognize images and
    speech in real-time. It is used in applications such as facial recognition, voice
    recognition, and object detection.
•   Fraud Detection: Machine learning is used to detect fraud in financial transactions. It
    can be used to identify fraudulent transactions, detect unusual patterns, and flag
    suspicious activities.
•   Healthcare: Machine learning is used in healthcare for diagnosis, treatment planning,
    and drug development. It can be used to analyze medical images, predict patient
    outcomes, and develop personalized treatment plans.
•   Predictive Maintenance: Machine learning is used in industrial settings to predict when
    machines will fail and need maintenance. This helps reduce downtime and improve
    productivity.
                                     Cont. …
•   Natural Language Processing: Machine learning is used in natural language
    processing to enable machines to understand human language. It is used in applications
    such as chatbots, voice assistants, and language translation.
•   Marketing: Machine learning is used in marketing to analyze customer behavior and
    preferences. It can be used to personalize marketing campaigns and recommend
    products to customers.
•   Autonomous Vehicles: Machine learning is used in autonomous vehicles to enable
    them to perceive their environment and make decisions. It is used in applications such as
    self-driving cars and drones.
•   Financial Forecasting: Machine learning is used in finance to forecast stock prices,
    predict market trends, and identify investment opportunities.
 Types of machine learning techniques
• A machine can learn to solve a problem
  by following any one of the following
  four techniques.
• These are the ways in which a machine
  can learn:
    1.   Supervised Learning
    2.   Unsupervised Learning
    3.   Semi-supervised learning
    4.   Reinforcement Learning
      Supervised Learning
• Supervised learning is a technique in which we teach or
  train the machine using data which is well labeled.
• To understand Supervised Learning let’s consider an
  example.
As kids need guidance to solve math problems. The teachers
helped them understand what addition is and how it is done.
Similarly, you can think of supervised learning as a type of
Machine Learning that involves a guide.
• Types of problem
   Regression
   Classification
      Supervised Learning Cont.
Here we’re feeding the machine images of Tom and Jerry and the goal
is for the machine to identify and classify the images into two groups
(Tom images and Jerry images). The training data set that is fed to
the model is labeled, as in, we’re telling the machine, ‘this is how Tom
looks and this is Jerry’. By doing so you’re training the machine by
using labeled data.
                 Unsupervised Learning
•   “Unsupervised learning involves training by using unlabeled data
    and allowing the model to act on that information without
    guidance.”
•   Think of unsupervised learning as a smart kid that learns without
    any guidance.
•   In this type of Machine Learning, the model is not fed with labeled
    data, as in the model has no clue that ‘this image is Tom and this is
    Jerry’, it figures out patterns and the differences between Tom and
    Jerry on its own by taking intentions of data.
•   Types of Problem
     Clustering
     Association
        Unsupervised Learning Cont.
For example, it identifies prominent features of Tom such as pointy
ears, bigger size, etc, to understand that this image is of type 1.
Similarly, it finds such features in Jerry and knows that this image is
of type 2. Therefore, it classifies the images into two different classes
without knowing who Tom is or Jerry is.
              Semi-supervised learning
• Semi-supervised learning offers a happy medium between
  supervised and unsupervised learning.
• During training, it uses a smaller labeled data set to guide
  classification and feature extraction from a larger, unlabeled
  data set.
• Semi-supervised learning can solve the problem of having not
  enough labeled data (or not being able to afford to label enough
  data) to train a supervised learning algorithm.
• Types of problem
   Combination of tasks in both supervised and unsupervised
              Reinforcement Learning
•   Reinforcement learning can be thought of as a try and error method of
    learning. The machine gets a Reward or Penalty point for each action it
    performs. If the option is correct, the machine gains the reward point or
    gets a penalty point in case of a wrong response.
•   The reinforcement learning algorithm is all about the interaction between
    the environment and the learning agent. The learning agent is based on
    exploration and exploitation.
•   Exploration is when the learning agent acts on trial and error and
    Exploitation is when it performs an action based on the knowledge gained
    from the environment.
•   The environment rewards the agent for every correct action, which is the
    reinforcement signal. With the aim of collecting more rewards obtained,
    the agent improves its environment knowledge to choose or perform the
    next action.
•   Types of problem
     Reward based
   Reinforcement Learning Example
Let see how Pavlov trained his dog using
reinforcement training?
Pavlov divided the training of his dog into four stages.
• In the first part, Pavlov gave meat to the dog, and in
  response to the meat, the dog started salivating.
• In the next stage he created a sound with a bell, but this
  time the dogs did not respond anything.
• In the third stage, he tried to train his dog by using the
  bell and then giving them food. Seeing the food the dog
  started salivating.
• Eventually, the dogs started salivating just after hearing
  the bell, even if the food was not given as the dog was
  reinforced that whenever the master will ring the bell, he
  will get the food.
Reinforcement Learning Example Cont.
20