AI&ML (Unit - 1)
AI&ML (Unit - 1)
• Reason, learn, and act in such a way that would normally require human
intelligence
• Involves data whose scale exceeds what humans can analyze.
• computer science,
• Linguistics, Neuroscience,
Contd.
• On an operational level for business use,
• Data analytics,
• object categorization,
• Recommendations,
• AI's ability to process massive data sets gives enterprises insights into their
operations they might not otherwise have noticed.
A World Without AI: What Would
Happen if We Lost All Our Tech?
• Prior to the current wave of AI, for example, it would have been hard to imagine
using computer software to connect riders to taxis on demand, yet Uber has become
a Fortune 500 company by doing just that.
• With AI, Your smart home systems, controlled by AI, seamlessly adjust the
thermostat, brew your coffee just the way you like it, and even remind you of your
appointments for the day
• Without AI, these conveniences evaporate, leaving you fumbling in the dark,
quite literally.
Contd.
• Think about our daily commute => our roads would turn into chaotic parking lots.
• Doctors and nurses would be back to square one, relying on old-school methods
to diagnose and treat patients.
• But without AI, these futuristic vehicles are grounded, contributing to urban
gridlock.
• Even leisure activities are shaped by AI, from personalized movie recommendations
to curated playlists.
• Without AI, we're overwhelmed by choices and long for the convenience of AI-
driven curation.
Contd.
• We might have already lost the ability to think for ourselves because we're so
dependent on AI.
• AI is a good fit for tasks that involve identifying subtle patterns and relationships
in data that might be overlooked by humans.
• For example, in Oncology,
• AI systems and automation tools dramatically reduce the time required for data
processing.
• This is particularly useful in sectors like finance, insurance and healthcare that
involve a great deal of routine data entry and analysis, as well as data-driven
decision-making.
• For example, in banking and finance, predictive AI models can process vast
volumes of data to forecast market trends and analyze investment risk.
Contd.
• Time savings and productivity gains =>
• AI and robotics can not only automate operations but also improve safety and
efficiency.
• In manufacturing, for example, AI-powered robots are increasingly used to
perform hazardous or repetitive tasks
• Thus reducing the risk to human workers and increasing overall productivity.
Contd.
• Customization and personalization =>
• This makes AI well suited for scenarios where data volumes and workloads can
grow exponentially, such as internet search and business analytics.
Foundations of Artificial Intelligence
• Data and Knowledge Representation
• An AI system needs huge amounts of data to find patterns and acquire insights to
"learn" and make decisions.
• The goal of knowledge representation, on the other hand,
• To organize this material such that computers can understand, store, and
retrieve it.
• The core of Artificial Intelligence is knowledge and data,
• In AI, ethical issues are becoming more and more important. By establishing
guidelines for
• how AI should function and be used in society,
• In AI, algorithms process data, make decisions, and learn from patterns.
• Types of Algorithms
• Supervised Learning Algorithms => the machine is trained on a set of labeled data
• The quality and quantity of data significantly impact the performance of AI models.
• Types of Data
• Structured Data
• Unstructured Data
• It’s often used in machine learning for tasks such as sorting, predicting, and
grouping.
• This type of data is crucial in fields like finance, the IoT, healthcare, and manufacturing
for forecasting and detecting trends or anomalies.
• It’s essential for NLP tasks like analyzing sentiments, classifying texts, recognizing
entities, translating languages, operating chatbots, and summarizing documents.
4. APIs and online services provide easy access to a variety of data sources, such as
social media platforms (e.g., Twitter API) and financial information (e.g.,
Bloomberg API), enabling developers to incorporate external data into AI
applications effortlessly.
7. Multimedia content comprises digital media forms like images, videos, audio, and
animations.
• They have relational key and can be easily mapped into pre-designed fields.
• Structured data is highly organized information that uploads neatly into a relational
database
• Structured data is relatively simple to enter, store, query, and analyze, but it must be
strictly defined in terms of field name and type
Unstructured Data
• Unstructured data may have its own internal structure, but does not conform neatly
into a spreadsheet or database.
• The fundamental challenge of unstructured data sources is that they are difficult for
nontechnical business users and data analysts alike to unbox, understand, and
prepare for analytic use.
Foundations of AI
Philosophy
• Intelligence and Consciousness
• Help develop ethical guidelines that inform the design, implementation, and
deployment of AI systems,
• Ensuring that these technologies respect human rights and promote fairness.
Mathematics
well-informed choices.
• Its effects on productivity, job markets, income inequality, and overall economic
growth, allowing for informed decision-making
• Regarding AI adoption and policy development across industries and societies.
• Neuroscience =>
• Train these neural networks to perform in computers the same tasks done by
parts of the brain, which means their computational traits can lead to hypotheses
about how brains compute.
• AI also is providing new methods for analyzing brain and behavioral data,
helping us decode the meaning of brain activity
Agents in Artificial Intelligence
• An AI system can be defined as the study of the rational agent and its environment.
• Types=>
• Rules =>
• Both types of agents are autonomous and can adapt to their environment.
• Has clear preference, models uncertainty, and acts in a way to maximize its
performance measure
• AI is about creating rational agents to use for game theory and decision theory
for various real-world scenarios.
• For an AI agent, the rational action is most important because in AI reinforcement
learning algorithm,
• for each best possible action, agent gets the positive reward
• When we define an AI agent or rational agent, then we can group its properties
under PEAS representation model.
PEAS for self-driving cars
PEAS for Chess Playing AI
• Performance =>
• Winning game
• Environment =>
• Chessboard
• Opponent
• Actuators =>
• Move chess pieces
• Sensors =>
• Board recognition
• Opponent moves
PEAS for Healthcare Diagnosis
• Performance =>
• Accurate disease identification
• Environment =>
• Patient data
• medical facilities
• Actuators =>
• Prescription
• Treatment planning
• Tests
• Sensors =>
• Medical records
• Diagnostic tests
• Patient data
What are AI agents?
• A software program that performs tasks autonomously by observing and
interacting with its environment.
• Designed to simulate human behavior, handling tasks with minimal human input by
processing data and making decisions.
• Advantages => Increase efficiency, reduce human error, and enhance decision-
making processes.
• Percept sequence is the complete history of everything the agent has ever perceived.
Agent interaction through Sensors and
Actuators
Vacuum-Cleaner world
Contd.
• Configuration with just two squares, A and B.
• The vacuum agent perceives which square it is in and whether there is dirt in the
square.
• The available actions are to move to the right, move to the left, suck up the dirt, or do
nothing.
• For each possible percept sequence, a rational agent should select an action that is
expected to maximize its performance measure
Omniscience, Learning and Autonomy
• An omniscient agent knows the actual outcome of its actions and can act accordingly;
• Our definition of rationality does not require omniscience, then, because the rational
choice depends only on the percept sequence to date (what is known to date)
Omniscient
• An omniscient AI agent would have perfect and complete knowledge of everything relevant
to its environment, including:
• All current and future states of the world.
• If an AI were truly omniscient, it could perfectly manipulate humans, predict every action, and
potentially control the future.
Learning
• Our definition requires a rational agent not only to gather information but also to
learn as much as possible from what it perceives.
• The agent’s initial configuration could reflect some prior knowledge of the
environment
• But as the agent gains experience this may be modified and augmented.
• There are extreme cases in which the environment is completely known a priori.
• In such cases, the agent need not perceive or learn; it simply acts correctly.
• An agent should learn what it can to compensate for partial or incorrect prior
knowledge
• A rational agent must select the best possible action based on available information.
• If it relies on external input for every decision, it becomes slower and less effective.
• Example: A self-driving car cannot wait for human approval for every turn—it
must act autonomously.
• Environments are often unpredictable, and a rational agent must adjust its strategy
without external intervention.
• Example: A robotic vacuum (like Roomba) encounters obstacles and must autonomously replan
its path.
• Autonomous agents can operate continuously and efficiently without human fatigue.
• Example: AI trading bots execute millions of stock trades per second without human supervision.
• For example in a Tic-Tac-Toe game, seeing the position of the elements on the
board is enough to make an optimal decision on the next move.
• When an agent sensor is capable to sense or access the complete state of an agent at each
point in time, it is said to be a fully observable environment else it is partially observable.
• Maintaining a fully observable environment is easy as there is no need to keep track of the
history of the surrounding.
• An environment is called unobservable when the agent has no sensors in all environments.
• Examples:
• Chess – the board is fully observable, and so are the opponent’s moves.
• Driving – the environment is partially observable because what’s around the corner is
not known.
Deterministic vs Stochastic
Episodic vs Sequential
• Episodic =>
• Consider an example of Pick and Place robot, which is used to detect defective
parts from the conveyor belts.
• Here, every time robot(agent) will make the decision on the current part i.e.
there is no dependency between current and previous decisions.
• Sequential =>
• The next action of the agent depends on what action he has taken previously and
what action he is supposed to take in the future.
• Example => Chess
Static vs Dynamic
Discrete vs Continuous
Single vs Multiple
Structure of Agents
• The task of AI => Design an agent program which implements the agent function.
f:P* → A
• It uses a set of condition-action rules coded into the system to make its decision or
take any action.
• Pros=>
• Easy to implement
• Cons=>
• Has limited intelligence
• They're effective in applications like autocorrect where it adjusts based on the user's
typing habits.
• The model-based reflex agent operates in four stages:
1. Sense: It perceives the current state of the world with its sensors.
3. Reason: It uses its model of the world to decide how to act based on a set of
predefined rules or heuristics.
4. Act: The agent carries out the action that it has chosen.
Pros and Cons
• Pros:
• Cons:
• using the model of the world to consider the future consequences of their
actions.
• They choose actions that lead them closer to their predefined goals.
• They're used in
• Cons:
• It requires more processing power for planning and evaluating potential actions.
• It is focused on goal achievement, which may not always align with the best
overall outcome.
Utility-based Agent
• Aim not just to achieve goals
• They evaluate the potential utility of different states and choose actions that
maximize this utility.
• They can modify their behavior based on past experiences and feedback, learning
from the environment to make better decisions.
• Example => Consider a learning agent as a student mastering a subject. With each
lesson, homework, and test (experiences and feedback), the student (agent) learns
and adjusts study habits (behavior) to improve grades (performance) over time.
• AI => Aim to give machines the ability to “think” and “learn from experience”
• ML => Building models that can learn and improve themselves over time with
minimal human input
• To train the algorithms to identify data patterns and relationships so that the
models can later use this knowledge to make predictions or execute tasks
themselves based on historical data.
Implemented machine learning-
based predictive maintenance
system to monitor their fleet of
60,000 vehicles. As a result, the
company has reported a 10%
reduction in maintenance costs and
a 15% reduction in vehicle
downtime.
• DHL has implemented an AI-based predictive maintenance system across its fleet of
over 60,000 vehicles.
• Tire pressure.
• By analyzing this data, the system can predict when a vehicle will likely require
maintenance, allowing DHL to schedule repairs before a breakdown occurs.
• By catching potential issues before they become critical, DHL has been able to keep
its fleet running smoothly, improving efficiency and reducing costs.
• DL => A sub field of ML, neural networks modelled after the human brain.
• Learn key information or features from raw data or recognize inaccurate information,
• Can process and understand intricate patterns and relationships in unstructured data.
• Anomaly detection => Quickly spot unusual or suspicious financial activities. Plus, since
the models are self learning, they can quickly adapt to any new fraudulent patterns that
appear.
• understand and respond to written or spoken words in almost the same way as we
do
• Takes raw, written, or spoken text and interprets it into a form that a computer can
understand and analyze.
• Speech-to-text transcription
Large Language Models (LLM)
• Designed to understand and generate human-like text in various forms,
depending on the prompts they receive.
• Why large?
• Faster translations
• Enhancing creativity => generate ideas, slogans, or content for marketing purposes.
Prompt Engineering
• Guide Generative Artificial Intelligence (generative AI) solutions to generate desired
outputs.
• Prompt Engineering => you choose the most appropriate formats, phrases, words,
and symbols that guide the AI to interact with your users more meaningfully.
• A prompt can contain information like the instruction or question you are passing to
the model and include other details such as context, inputs, or examples.
• Example:
OpenAI Playground or any other LLM
playground
• Lets improve it a bit,
Or
• zero-shot prompting => Directly prompting the model for a response without any
examples or demonstrations about the task you want it to achieve.
Zero Shot Prompting
• No examples are provided, and the model must rely entirely on its pre-trained
knowledge.
• Uses LLMs' generalization capabilities to attempt new tasks without prior specific
training or examples.
• Prompt: Classify the animal based on its characteristics. Animal: This creature has
eight legs, spins webs, and often eats insects.
• Output: Spider.
• Providing a single example before the new task, which helps clarify
expectations and improves model performance.
Few Shot Prompting
• you provide exemplars (i.e., demonstrations)
• Prompt engineering is the process of enhancing the output of large language models
(LLMs), such as OpenAI’s GPT-4
• Involves carefully crafting input prompts to help the language model understand the
context and produce desired results.
• This process requires creativity, understanding of the language model, and precision
in formulating prompts for a specific task.
• Your choice of words and their sequence can change the quality and relevance of the
generated content.
• For example, if a chatbot provides customer support, prompt engineers can update it
with the latest information about products and services.
• This helps make sure customers get the help they need.
• Those who own the technologies reap the benefits while others may lose their
livelihoods.
• Security Risks
• Loss of Privacy
• Lack of creativity