Advanced Concepts of Modeling in AI

Advanced Concepts of Modeling in AI

Artificial Intelligence (AI), Machine Learning (ML), and Deep Learning (DL)

  • Artificial Intelligence (AI): Any technique that enables computers to mimic human intelligence. AI works on algorithms and data to produce a desired output.

  • Machine Learning (ML): Enables machines to improve at tasks with experience, learning from new data and exceptions to refine future iterations.

  • Deep Learning (DL): Enables software to train itself using vast amounts of data. It utilizes multiple machine learning algorithms to perform specific tasks, representing an advanced form of AI.

Relationship between AI, ML, and DL

  • AI is the overarching term encompassing both DL and ML.

  • DL is a specific subset of ML, employing multiple ML algorithms.

Venn Diagram Representation

  • Artificial Intelligence: The ability of a machine to imitate human intelligence.

  • Machine Learning: A subset of AI, using algorithms that enable machines to learn from data and make decisions.

  • Deep Learning: A subset of ML, using algorithms inspired by the structure of the human brain and based on artificial neural networks.

Machine Learning (ML) Explained

  • ML enables machines to improve at tasks with experience.

  • Machines learn from mistakes, considering them in subsequent executions and improving through experience.

Example of Machine Learning
  • Labeled images (e.g., apples and strawberries) are input into an ML model.

  • The ML model learns to classify between the objects and predicts the correct output.

  • Object Classification:

    • Identifies and labels objects within an image or data point.

    • Determines the category to which an object belongs.

  • Anomaly Detection:

    • Helps identify unexpected things in data.

    • Example: Detecting a sudden spike in heart rate as a potential issue.

Deep Learning (DL) Explained

  • DL enables software to train itself to perform tasks with vast amounts of data.

  • Machines train themselves using huge datasets, developing algorithms autonomously.

  • DL is the most advanced form of AI among the three.

Example of Deep Learning
  • Pixels of a bird image are input into a DL model.

  • The model analyzes the input and correctly predicts that it is a bird using a deep learning algorithm (ANN).

  • Object Identification:

    • Identifies and labels objects within an image.

    • Uses algorithms to determine the contents of a picture and categorize them.

  • Digit Recognition:

    • Trains computers to identify handwritten digits (0-9) within images.

Data, Features, and Labels

What is Data?
  • Data is information in any form, such as a table with information about fruits.

  • Each row contains information about different fruits, described by certain features.

What are Features?
  • Columns of the tables are called features (e.g., name, color, size).

  • Some features are labels.

What are Labels?
  • Labels depend on the context of the problem.

  • Example: If predicting a fruit based on its color, color is the feature, and the fruit name is the label.

  • Data can be labeled or unlabeled.

  • Data Labeling: The process of attaching meaning to data.

Labeled vs. Unlabeled Data
  • Labeled Data:

    • Data with an attached tag/label (e.g., name, type, number).

  • Unlabeled Data:

    • Raw form of data with no tag attached.

Training and Testing Data Sets

Training Data Set
  • A collection of examples given to the model to analyze and learn.

  • Analogy: A teacher teaching a topic through examples.

  • A set of labeled data is used to train the AI model.

Testing Data Set
  • Used to test the accuracy of the model.

  • Analogy: A teacher giving a class test to evaluate understanding.

  • Testing is performed without labeled data, and results are verified with labels.

AI Modeling

  • AI Modeling refers to developing algorithms (models) trained to get intelligent outputs.

  • It involves writing code to make a machine artificially intelligent.

Types of AI Models

  • Learning Based:

    • Supervised Learning

    • Unsupervised Learning

    • Reinforcement Learning

  • Rule Based

  • Deep Learning

    • Artificial Neural Networks

    • Convolution Neural Networks

Rule-Based Approach

  • Involves AI modeling where the developer defines the relationships or patterns in data.

  • The machine follows the rules or instructions mentioned by the developer.

  • Rule-based Chatbots are used to answer FAQs or provide basic customer support.

Scenario: Clothing Website Chatbot
  • Data:

    • The Chatbot relies on a predefined set of questions and corresponding answers.

  • Rules:

    • The Chatbot uses a decision tree approach.

    • Rule 1: If the user's message contains keywords like "track order," proceed to order tracking options.

    • Rule 2: Under order tracking options:

      • If the user asks for their order number, prompt them to enter it.

      • If the user enters a valid order number, retrieve the tracking information.

      • If the user enters an invalid order number, provide an error message.

    • Rule 3: If the user's message doesn't match any defined rules, offer a message like "Sorry, I can't help you with that."

  • Interaction:

    • The Chatbot analyzes user messages based on defined rules and responds with pre-written answers or prompts for more information.

Drawbacks/Features of Rule-Based Approach
  • The learning is static.

  • The machine does not consider changes in the original training dataset.

  • The machine will fail if tested on a dataset different from the rules and data used in training.

  • Once trained, the model cannot improvise based on feedback.

  • Machine learning extends this by allowing machines to adapt to changes in data and rules.

Learning Based Approach

  • A method where a computer learns how to do something by looking at examples or getting feedback.

  • Instead of being explicitly programmed, the computer learns to perform a task by analyzing data and finding patterns or rules on its own.

Example
  • Given 1,000 unlabeled images of stray dogs, the AI can identify patterns and group them based on color, size, or fur type, even uncovering patterns a human might not think of.

  • Spam email filter: Trained on labeled examples of spam and non-spam emails, it learns to detect spam and improves accuracy as it processes more data.

Categories of Machine Learning Based Models

  • Supervised Learning

  • Unsupervised Learning

  • Reinforcement Learning

Supervised Learning

  • A type of machine learning where the data used to train the model is labeled.

  • Labels act as tags that help the machine learn the relationship between input and output.

  • Analogy: A student learning from a teacher who uses solved examples and then gives problems to solve.

Example Summary:
  • The model is trained using labeled data.

  • Example: Coins of different currencies with known weights (1 Euro = 5g, 1 Dirham = 7g, etc.).

  • Weight is the feature, and currency is the label. The model can predict the type of coin based on its weight.

  • The model can also be trained to classify animals (cats and dogs) by learning from labeled data and then applying that knowledge to new, unseen data.

Unsupervised Learning

  • Works with unlabeled data, meaning the model receives raw, unclassified input and must find patterns or relationships on its own.

  • The trainer may not have prior knowledge about the data.

  • Example: With 1,000 random images of dogs, an unsupervised model can analyze them and group them based on features like color or size—even identifying unexpected patterns.

  • It’s like a child learning to swim without guidance, exploring and discovering independently.

Example
  • In a supermarket scenario, customer purchase data is analyzed without labels indicating regular grocery shoppers.

  • The model can automatically group customers, separating regular grocery buyers from others, without prior labeling.

  • If given unlabeled images of animals, the model might identify shared features and create clusters, such as Cluster 1: All cats, Cluster 2: All dogs.

Supervised vs. Unsupervised Learning

  • Supervised Learning:

    • Deals with labeled data.

    • Useful in real-world problems like predicting the prices of an item based on past trends.

    • Computing power required is simpler due to clean labeled data.

  • Unsupervised Learning:

    • Deals with unlabeled data.

    • Useful in finding unknown patterns within data, like making sense of observations from an experimental device.

    • The computing power required is more complex due to unsorted and messy data.

Reinforcement Learning

  • This learning approach enables the computer to make a series of decisions that maximize a reward metric for the task without human intervention and without being explicitly programmed to achieve the task.

  • It improves performance through trial and error based on feedback.

Example
  • If the machine is shown an image of an apple:

    • It first guesses "cherry" and receives negative feedback.

    • When shown the apple again, it guesses "apple" and receives positive feedback.

    • This feedback loop helps the machine gradually improve and make better decisions over time.

What Makes Reinforcement Learning Different?

  • Supervised and unsupervised learning require a good understanding of the data and problem beforehand.

  • Reinforcement learning is useful in complex, changing environments where pre-existing data is limited or unavailable.

  • It allows systems to adapt and learn through interaction, without needing detailed prior knowledge.

  • This makes reinforcement learning ideal for scenarios where the environment is dynamic and unpredictable.

Examples of Reinforcement Learning
  • AI Learns to Park (Parking a car)

  • DEEPMIND AI LEARNED HOW TO WALK (Humanoid walking)

Summary of ML Models

  • Supervised learning models are used when we want to determine relationships through training.

  • Unsupervised learning models are used when we want to discover new patterns from data.

  • Reinforcement learning models are used when we want to implement machine learning through a reward mechanism.

Family of ML Models

  • Supervised Learning: Determine relationships through training.

  • Unsupervised Learning: Discover new patterns.

  • Reinforcement Learning: Learn by rewarding actions.

Sub-categories of Supervised Learning Model

  • Classification Model

  • Regression Model

Classification Model
  • Here the data is classified according to the labels.

  • Analogy: In a grading system, students are classified based on the grades they obtain with respect to their marks in the examination.

  • This model works on discrete dataset.

Examples Summary:
  • Classification models categorize data into predefined classes.

    • Weather Prediction:

      • The model is trained on historical weather data labeled as "hot" or "cold."

      • When given new data, it predicts whether the weather will be "hot" or "cold."

    • Email Spam Detection:

      • The model is trained on emails labeled as spam or not spam.

      • When it sees a new email, it classifies it accordingly.

Regression Model
  • Such models work on continuous data.

  • Example: Use the data of your previous salary, any increments, etc., and would train the model to predict your next salary

  • Regression algorithms predict a continuous value based on the input variables.

  • Continuous values as Temperature, Price, Income, Age, etc.

Examples:
  • Example 1: Predicting temperature

    • Temperature is a continuous variable.

  • Example 2: Predicting the price of the house

    • Predicting the price of the house based on parameters like the number of bedrooms, carpet size, and garage area.

  • Example 3: Used Car Price Prediction

    • This model predicts the selling price of the car with the help of parameters like fuel type, years of service, kilometers driven, etc.

Sub-categories of Unsupervised Learning Model

  • Clustering model and Association model.

What is Clustering?
  • Clustering is a process of dividing the data points into different groups or clusters based on their similarity between them.

Example
  • The input data contains unlabeled images of birds and animals.

  • The unsupervised learning model groups the data into two clusters based on similarities:

    • Cluster 1: Animals

    • Cluster 2: Birds

Difference between Clustering and Classification
  • Classification uses predefined classes in which objects are assigned.

  • Clustering finds similarities between objects and places them in the same cluster and it differentiates them from objects in other clusters

Clustering Example – Music Recommendation:
  • Songs are grouped into clusters based on tempo and intensity:

    • Cluster 1: Songs Jim likes (slow tempo, soft intensity)

    • Cluster 2: Songs Jim dislikes (fast tempo, high intensity)

  • If a new song has a slow tempo and soft intensity, the model can predict that Jim will likely like it.

Association
  • Association Rule is an unsupervised learning method that is used to find interesting relationships between variables from the database.

Example:
  • Based on the purchase pattern of customers, We can predict that there is high probability that any customer x who buys bread will most probably buy butter.

  • Therefore, such meaningful associations can be useful to recommend items to customers. This is called Association Rule.

Summary of detailed classification of ML models

  • Machine Learning

    • Supervised Learning

      • Classification

      • Regression

    • Unsupervised Learning

      • Clustering

      • Association

    • Reinforcement Learning

Sub-Categories of Deep Learning

Deep Learning enables software to train itself to perform tasks with vast amounts of data. In deep learning, the machine is trained with huge amounts of data which helps it to train itself around the data. Such machines are intelligent enough to develop algorithms for themselves. There are two types of Deep Learning models
* Artificial Neural Networks (ANN)
* Convolution Neural Network (CNN)

Deep Learning

  • Artificial Neural Network (ANN)_

  • Convolution Neural Network (CNN)

Artificial Neural Networks (ANN):
  • Modeled after the human brain and nervous system.

  • Can automatically extract features from data without programmer input.

  • Each node (or neuron) functions like a mini machine learning algorithm.

  • Especially useful for handling large and complex datasets.

Convolutional Neural Networks (CNN):
  • A type of Deep Learning model designed for image processing.

  • Analyzes input images by assigning learnable weights and biases to features.

  • Can identify and differentiate objects within images.

  • Widely used in applications like image recognition, facial detection, and computer vision tasks.

Artificial Neural Networks
  • Neural networks are inspired by how neurons in the human brain work. They are capable of automatically extracting features from data without needing manual input from a programmer.

    • Key Advantages:

      • Ideal for large datasets (e.g., images)

      • Fast and efficient in solving complex problems

Structure of a Neural Network:
  • Input Layer:

    • Receives Raw Data

    • No Processing happens here

  • Hidden Layers:

    • Each node uses weights and biases to process data

    • Outputs are passed through an activation function to introduce non- linearity

    • The network learns through trial and error, adjusting weights to reduce error between predicted and actual output

    • There can be multiple hidden layers depending on the problem’s complexity

    • The number of nodes in each layer can also vary

  • Output Layer:

    • Receives the final processed result from the last hidden layer

    • No computation is done here—it's simply for user interface and output display
      Real-world applications of neural network are facial recognition, customer support chatbot, vegetable price prediction etc

Real-world applications of neural network are facial recognition, customer support chatbot, vegetable price prediction etc.

How AI Makes a Decision

Summary:
  • AI decision-making through models like the perceptron is similar to human reasoning:

    • It evaluates inputs based on importance.

    • Uses past experiences or preferences to assign weights.

    • Applies a logical rule (like threshold comparison) to make decisions.

    • Everyone may weigh inputs differently, which is why AI systems can be personalized—just like people make different choices in the same situation.

Example: Deciding whether to go to the park.

Let’s say:

  • You have a jacket (1)

  • You don’t have an umbrella (0)

  • It is sunny now (1)

  • The forecast says rain later (0)

  • Bias is 1 (cautious personality)

Key Concepts:
  • Inputs (X): These are the conditions or questions (e.g., "Is it sunny?").

  • Weights (W): Each input is given a weight that reflects how important it is.

  • Bias (B): A constant input (usually 1) that reflects a person's general tendency (e.g., cautious or adventurous).

  • Weighted Sum: All inputs are multiplied by their weights, summed up with the bias.

  • Activation Function: This sum is compared to a threshold. If it exceeds the threshold, the AI says “Yes, go out” otherwise “No, stay in.”

  • After calculating the weighted sum and comparing it to the threshold, the output is 0.5, which is above the threshold, so the decision is: ✅ Go to the park

  • draw the perceptron with four inputs (from X1 to X4). Next, we have their weights (from W1 to W3). Then, we also have the bias B, with weight WB.

Perceptron Example (go to the park)
Example :

Do I have a jacket,Do I have umbrella,Is it sunny now,What is the weather forecast for later.

Important Note
  • There is no right or wrong answers in coming up with the values for the weights, The values for the weights can come from experience

  • we can convert the yes and no to numbers 1 and 0.

  • For bias, we will always take 1.