Artificial Intelligence
Artificial Intelligence
History of AI
The term "artificial intelligence" was coined in 1956 by John McCarthy, a computer scientist.
He introduced the term at the Dartmouth Conference, which is considered the birthplace of
AI as a field of study. This conference brought together leading researchers to explore the
possibilities of machines mimicking human intelligence.
Over the years, AI had its ups and downs, especially in the 1970s and 1980s, due to limits in
technology
Things improved in the late 1990s, with AI becoming more powerful. In 1997, IBM's Deep
Blue beat chess champion Garry Kasparov. The 2000s saw AI grow with machine learning
and cool technologies like voice assistants and self-driving cars.
In the 2020s, AI took another leap with tools like ChatGPT and Google's Bard, which can
create text and art. However, this tech is still being improved to avoid errors.
AI Based on Capabilities:
1. Weak AI (Narrow AI):
o What it does: It’s like a smart tool that can perform one specific task really
well. Think of it as an expert at a single thing but not much else.
o Example:
Apple’s Siri can follow voice commands, answer questions, or play music, but
it can’t cook or drive a car. It’s limited to the tasks it's designed for.
IBM’s Watson: A supercomputer that excels at data analysis, making medical
diagnoses, and winning the game "Jeopardy!" Watson combines Expert
Systems, Machine Learning, and Natural Language Processing (NLP) but is
still limited to specific tasks.(like self driving cars only on data analysis)
o Where you see it: In things like self-driving cars, facial recognition on phones,
or virtual assistants like Alexa and Siri.
2. General AI (Strong AI):
o What it does: This is the dream of AI that can think and learn like a human,
doing any intellectual task you throw at it.
o Example: Imagine a robot that can solve math problems, write stories, and
also cook a perfect meal—just like a human can. But this kind of AI doesn’t
exist yet.
o Where you see it: It’s still in research. We don’t have any real examples yet.
3. Super AI:
o What it does: This would be AI that’s smarter than humans in every way,
capable of solving complex problems, thinking, and making decisions better
than us.
o Example: It’s like a super-intelligent robot from a sci-fi movie that can do
anything a human can, but much faster and more accurately. However, this is
just an idea for now.
o Where you see it: It’s still a future concept, and no such AI exists today.
AI Based on Functionality:
1. Reactive Machines:
o What it does: These are basic AIs that can only react to the situation in front
of them. They don’t remember past experiences.
o Example: IBM’s Deep Blue, which played chess against a human. It only
thought about the current move and didn’t learn from past games.
o Google’s AlphaGo: AlphaGo was designed to play the board game Go and
defeated the world champion. Like Deep Blue, it reacts to the current board
state without remembering past games.
o Where you see it: In systems like simple game-playing computers.
2. Limited Memory:
o What it does: These AIs can remember things for a short time and use that
information to make better decisions.
o Self-Driving Cars: Cars like those from Tesla use Limited Memory AI to
monitor surrounding vehicles, speed, and road conditions to drive safely.
They store recent data to make decisions but don’t retain it long-term.
o ChatGPT (current versions): When answering questions, models like this can
consider the recent conversation context but don’t permanently remember
past interactions.
o Where you see it: In self-driving technology and some voice assistants that
learn from user behavior.
3. Theory of Mind:
o What it does: This type of AI aims to understand human emotions and
thoughts, allowing it to have social interactions like humans.
o Example: No full examples exist yet, but it would be like a robot that can
understand if you’re happy or sad and respond appropriately.
o Where you see it: It’s still in the research phase.
4. Self-Aware AI:
o What it does: This would be the ultimate AI that has its own consciousness
and can think and feel like a human. It would be aware of itself and its
surroundings.
o Example: We don’t have any examples because this type of AI doesn’t exist
yet.
o Where you see it: It’s a concept for the distant future.
In short, AI today is mostly Narrow AI (doing specific tasks), while General and Super AI are
goals for the future. On the functional side, we currently have reactive machines and limited
memory AI, with more advanced types still in development.
Advantages of AI:
1. Automation and Efficiency: AI automates repetitive tasks, increasing productivity
and reducing human error, especially in industries like manufacturing and customer
service.
2. Data-Driven Insights: AI can analyze vast amounts of data quickly, helping businesses
and professionals make better decisions based on patterns and trends.
3. 24/7 Availability: AI systems can operate continuously without the need for breaks,
making them ideal for tasks like monitoring and customer support.
Challenges of AI:
1. Ethical Concerns: Ensuring AI is used ethically, avoiding bias, and preventing misuse
in areas like surveillance and discrimination.
2. Job Displacement: AI-driven automation threatens to replace human jobs,
particularly in routine and repetitive tasks, leading to unemployment in certain
sectors.
3. Security Vulnerabilities: AI systems are susceptible to hacking and manipulation,
raising concerns about the safety of autonomous machines like self-driving cars.
Disadvantages of AI:
1. Lack of Creativity: AI lacks human creativity and emotional intelligence, making it
unsuitable for tasks that require intuition or emotional engagement.
2. Dependence on Data: AI systems rely heavily on data, and if the data is biased or
flawed, the AI’s output will also be inaccurate or problematic.
3. Privacy Issues: AI-driven technologies, especially in surveillance and data collection,
can infringe on privacy rights, raising ethical and legal concerns.
What are Agent and Environment?
An agent is anything that can perceive its environment through sensors and acts upon that
environment through effectors.
Agent and Environment:
Agent: An agent is anything that can sense its surroundings (environment) and take
actions to change it. Think of it like a robot, human, or even a software program.
o A human agent uses eyes, ears, nose, skin (sensors) to observe the
environment and hands, legs, or mouth (effectors) to take action.
o A robotic agent might have cameras or infrared sensors to "see" and motors
or arms to move things.
o A software agent (like a computer program) doesn’t have physical parts but
uses code to process information and perform tasks.
Agent Terminology:
1. Performance Measure: This is how we judge how good the agent is at its job. For
example, how well a self-driving car avoids accidents.
2. Behavior of Agent: It refers to what actions the agent takes after observing its
environment. For example, if it "sees" a wall, it will turn to avoid hitting it.
3. Percept: This is what the agent senses at any moment, like a robot seeing a red light.
4. Percept Sequence: The history of everything the agent has sensed so far. It helps the
agent make better decisions.
5. Agent Function: This is like a rulebook that tells the agent how to act based on what
it has sensed.
3.ADVERSARIAL SEARCH
Definition: Adversarial search refers to situations where multiple agents or players are trying
to achieve conflicting goals in the same search space, like in games. One agent’s actions
impact the others, making it a competitive environment. In this search, each agent must
consider not only their moves but also anticipate the moves of the opponent.
Types of Games in Adversarial Search:
1. Perfect Information: All players have full visibility of the game’s current state.
Examples: Chess, Checkers.
2. Imperfect Information: Some information is hidden, and players do not know
everything about the current state of the game. Examples: Poker, Bridge.
Deterministic vs. Non-deterministic Games:
Deterministic Games: Follow a set of rules with no randomness. Examples: Chess,
Tic-Tac-Toe.
Non-deterministic Games: Include random elements like dice or cards, introducing
luck or chance. Examples: Poker, Monopoly.
Zero-Sum Games:
Definition: In zero-sum games, one player’s gain is the other player’s loss. For
example, in Chess or Tic-Tac-Toe, if one player wins, the other loses.
Embedded Thinking: Each player tries to predict the opponent's move while planning
their own move.
Key Elements of Game Search:
1. Initial State: The game setup at the start.
2. Players: The agents or players involved.
3. Actions: The possible legal moves.
4. Result: The outcome of a specific move.
5. Terminal Test: A check if the game is over (like a win, loss, or draw).
6. Utility: The numeric value (score) for a terminal state.
Game Tree:
A game tree is used to model game decisions. Each node represents a game state, and each
edge represents a possible move.
MAX: The player trying to maximize their score (e.g., in Chess).
MIN: The player trying to minimize MAX's score.
Minimax Algorithm:
Goal: The Minimax algorithm helps in choosing the best move by simulating all
possible future moves.
Process: MAX tries to maximize the score, while MIN tries to minimize it. This creates
a tree of moves where both players alternate turns.
Alpha-Beta Pruning:
Definition: Alpha-Beta pruning is an optimization to the Minimax algorithm. It
reduces the number of nodes that need to be evaluated by “pruning” branches that
will not affect the final decision.
Benefit: It speeds up the decision-making process in games by avoiding unnecessary
evaluations.
Heuristics:
Heuristic Function: Used when searching the entire game tree is impractical. It
estimates the value of a game position without looking at every possible outcome.
Key Points for Interviews:
Adversarial search is used in games where players compete with each other.
The Minimax algorithm and Alpha-Beta pruning are fundamental to adversarial
search.
Understanding the difference between perfect/imperfect information and
deterministic/non-deterministic games is crucial for grasping adversarial search in AI.
Machine learning (ML) is a subset of artificial intelligence (AI) that focuses on the
development of algorithms and models that allow computers to learn from and make
predictions or decisions based on data.
Unlike traditional programming, where explicit instructions are given to a computer, ML
systems improve their performance automatically by identifying patterns in the data they
process.
Supervised machine learning is one of the most commonly used types of machine learning
where an algorithm is trained using a labeled dataset.
In this learning approach, each training example is associated with an input-output pair,
meaning that the algorithm is provided with both the input features (independent variables)
and the corresponding output labels (dependent variables).
The goal is for the algorithm to learn from this labeled data so that it can make predictions
or decisions when it encounters new, unseen data.
Types of Supervised Learning:
1. Regression:
o Definition: Regression involves predicting continuous numerical values based
on the input features. The model learns the relationship between the input
variables and the output value and then predicts continuous values for new
data.
o Use Cases: Regression is typically used for forecasting or estimating values,
such as predicting stock prices, house prices, temperature, or sales.
o Popular Regression Algorithms Linear Regression, Polynomial Regression,
Ridge Regression, Decision Tree Regression, Random Forest Regression,
Support Vector Regression, etc
2. Classification:
Definition: Classification involves predicting discrete classes or categories. The
algorithm learns to assign input data to specific categories or labels based on
the input features. The output labels are usually binary (e.g., 0 or 1) or
multiclass (e.g., multiple categories).
Use Cases: Classification is widely used in spam detection, image recognition,
medical diagnosis, sentiment analysis, and fraud detection.
Popular clustering he different Classification algorithms in machine learning
are: Logistic Regression, Naive Bayes, Decision Tree, Support Vector Machine
(SVM), K-Nearest Neighbors (KNN), etc
Unsupervised machine learning is a type of machine learning where the model learns
patterns from unlabelled data. Unlike supervised learning, in unsupervised learning, the data
is not categorized or labeled, and the algorithm has to identify hidden structures and
relationships within the data on its own. The primary goal is to find patterns, groupings, or
representations of the data that are meaningful and informative.
Main Types of Unsupervised Learning:
1. Clustering:
o Definition: Clustering is a technique that groups similar data points together
based on their features, where the goal is to find natural groupings or clusters
in the dataset. It helps to identify structures or patterns in data where no
prior labels are available.
o Use Cases: Clustering is widely used in market segmentation, customer
grouping, image compression, and anomaly detection.
o Popular Clustering Algorithms: K-Means Clustering:;Hierarchical
Clustering ;DBSCAN (Density-Based Spatial Clustering of Applications with
Noise) Mixture Models (GMM
2. Dimensionality Reduction:
o Definition: Dimensionality reduction is the process of reducing the number of
input features or variables in a dataset while retaining the most important
information. This is especially useful when dealing with high-dimensional
data, as it simplifies the dataset, reduces computational complexity, and helps
in visualization.
o Use Cases: Dimensionality reduction is commonly used in data visualization,
feature extraction, noise reduction, and speeding up machine learning
algorithms.
o Popular Dimensionality Reduction Algorithms:Principal Component Analysis
(PCA): ,-SNE (t-Distributed Stochastic Neighbor Embedding):, Autoencoders
Reinforcement learning (RL) is a branch of machine learning where an agent learns by
interacting with an environment and taking actions to maximize some notion of cumulative
reward. The agent learns through trial and error, receiving feedback in the form of rewards
(positive feedback) or penalties (negative feedback) based on the consequences of its
actions. The objective is to develop an optimal policy, which is a mapping from states of the
environment to actions, that maximizes the long-term reward over time.
Core Concepts in Reinforcement Learning:
1. Agent: The learner or decision-maker that interacts with the environment and takes
actions.
2. Environment: The external system with which the agent interacts. It provides the
current state to the agent and responds to the agent’s actions by transitioning to a
new state and providing a reward or penalty.
3. State: The current situation or configuration of the environment as perceived by the
agent.
4. Action: The decisions or moves made by the agent in the environment.
5. Reward: A numerical signal received by the agent after taking an action, representing
the immediate feedback on the action's success.
6. Policy: A strategy used by the agent to determine which action to take in each state.
It can be deterministic or stochastic.
7. Value Function: A function that estimates the expected cumulative reward starting
from a certain state (or state-action pair). It helps guide the agent toward the optimal
policy.
8. Exploration vs. Exploitation: The balance between trying new actions (exploration)
to discover more about the environment and leveraging known actions (exploitation)
to maximize rewards based on current knowledge.
Reinforcement learning (RL) is a branch of machine learning where an agent learns by
interacting with an environment and taking actions to maximize some notion of cumulative
reward. The agent learns through trial and error, receiving feedback in the form of rewards
(positive feedback) or penalties (negative feedback) based on the consequences of its
actions. The objective is to develop an optimal policy, which is a mapping from states of the
environment to actions, that maximizes the long-term reward over time.
Core Concepts:
Agent: The decision-maker.
Environment: The external system where the agent operates.
State: The current condition of the environment.
Action: Decisions the agent can make.
Reward: Feedback received after each action (positive or negative).
Policy: A strategy used by the agent to determine which action to take in each state.
It can be deterministic or stochastic.
Value Function: A function that estimates the expected cumulative reward starting
from a certain state (or state-action pair). It helps guide the agent toward the
optimal policy.
Exploration vs. Exploitation: The balance between trying new actions (exploration)
to discover more about the environment and leveraging known actions (exploitation)
to maximize rewards based on current knowledge.
What is Linear Regression?
Linear regression is a supervised learning algorithm used in machine learning for predicting a
continuous dependent variable (denoted as Y) based on one or more independent variables
(denoted as X). It establishes a linear relationship between the dependent variable and the
independent variables. The relationship is represented by a straight line (best-fit line) on a
graph.
Types of Linear Regression:
Cost Function:
A cost function measures how well the linear regression model fits the data. In linear
regression, the cost function is often the Mean Squared Error (MSE), which calculates the
average of the squared differences between the predicted values yi^\hat{y_i}yi^ and actual
values yiy_iyi:
Gradient Descent:
Gradient descent is an optimization algorithm used to minimize the cost function. The
model updates the parameters θ1 and θ2 iteratively by moving in the direction of the
steepest descent of the cost function. The update rule is:
The algorithm continues to update θ1\theta_1θ1 and θ2\theta_2θ2 until it reaches the
global minimum, where the cost function is minimized.
Steps of Gradient Descent:
1. Initialize parameters θ1and θ2\ randomly.
2. Calculate the cost function using the current parameters.
3. Update the parameters using the gradient of the cost function.
4. Repeat the process until convergence, where the change in the cost function
becomes very small.
Linear Regression Line:
The linear regression line is the best-fitting straight line that captures the overall trend of
the dependent variable (Y) as it responds to changes in the independent variable (X). This
line provides a way to predict or explain the relationship between these variables.
Types of Linear Regression Lines:
1. Positive Linear Regression Line:
o A positive linear regression line represents a direct relationship between X
and Y.
o As the value of X increases, the value of Y also increases.
o The slope of the line is positive, meaning the line slants upward from left to
right.
2. Negative Linear Regression Line:
o A negative linear regression line represents an inverse relationship between
X and Y.
o As the value of X increases, the value of Y decreases.
o The slope of the line is negative, meaning the line slants downward from left
to right.
Regularization Techniques for Linear Models:
Regularization techniques are used in linear models to reduce overfitting and improve the
generalizability of the model by adding a penalty to the cost function. This helps in
controlling the magnitude of coefficients in the regression model.
CNNs are highly effective for computer vision tasks, reducing the complexity of high-
dimensional data (like images) while learning the most important patterns or features
through convolution and poolin```
1. Feedforward Networks: Data moves in a single direction from input to output. No feedback loops exist.
2. Multilayer Perceptron (MLP): A type of feedforward network with one or more hidden layers, used in regression and classification tasks.
3. Convolutional Neural Network (CNN): Designed for image processing, CNNs use convolutional layers to automatically learn hierarchical features
from images.
4. Recurrent Neural Network (RNN): Designed for sequential data, RNNs have feedback loops that allow them to maintain contextual information,
making them useful for time-series prediction and natural language processing.
5. Long Short-Term Memory (LSTM): A specialized RNN designed to avoid the vanishing gradient problem. LSTMs use memory cells to retain
information over long periods, making them suitable for complex sequential tasks.