AI notes
AI notes
1. Language Models
Language models predict the likelihood of a sequence of words in a language. They
are foundational in natural language processing tasks, such as text generation, speech
recognition, and translation.
Types of Language Models:
Statistical Language Models (SLMs): Use probabilities derived from a corpus.
Neural Language Models (NLMs): Use neural networks to model language
(e.g., GPT, BERT).
Example:
For the sentence: "The cat is on the mat,"
A language model assigns a probability to the sequence:
P("The cat is on the mat") = P("The") × P("cat" | "The") × P("is" | "The cat") ...
2. N-grams
N-grams are contiguous sequences of n items (words, characters) from a given text.
They are used in language modeling, text classification, and speech recognition.
Types:
Unigram: Single word (e.g., The, cat, is).
Bigram: Two-word sequence (e.g., The cat, cat is).
Trigram: Three-word sequence (e.g., The cat is).
Example:
For the text: "I love programming."
Bigrams: (I love), (love programming).
5. Text Classification
Text classification assigns categories to text based on its content using machine
learning models like Naive Bayes, SVM, or neural networks.
Example:
Sentiment Analysis: Classify reviews as positive, negative, or neutral.
Input: "The movie was amazing!"
Output: Positive.
6. Information Retrieval
Information retrieval (IR) is the process of fetching relevant information from a
database or the web based on a query.
Example:
Search Engines:
Query: "Best programming languages for AI"
Retrieves ranked results from indexed web pages.
7. PageRank
PageRank is an algorithm used by search engines to rank web pages based on their
importance, determined by the quality and quantity of links pointing to them.
Example:
Page A links to Pages B and C. Page B links back to Page A. PageRank increases for
pages with backlinks from high-quality pages.
8. Information Extraction
Information extraction (IE) identifies structured information (e.g., entities,
relationships) from unstructured text.
Example:
Text: "Barack Obama was born in Hawaii in 1961."
Extracted Information:
Entity: Barack Obama (Person).
Location: Hawaii.
Date: 1961.
Would you like more details or practical examples on any of these topics?
Definition of Agents
An agent is an autonomous entity capable of perceiving its environment through
sensors and acting upon it using actuators to achieve specific goals. Agents are used in
AI systems, robotics, and software systems.
Characteristics of Agents:
1. Autonomy: Operates without direct human intervention.
2. Reactivity: Responds to changes in its environment.
3. Proactiveness: Takes initiative based on objectives.
4. Social Ability: Interacts with other agents or humans.
5. Learning: Improves behavior over time based on experiences.
Agent Architectures
Agent architectures define the underlying design principles for how agents perceive,
process, and act.
1. Reactive Architecture
Focuses on immediate responses to stimuli.
Does not involve complex reasoning or memory.
Examples include reflex-based systems like robotic obstacle avoidance.
Example: A robot detecting an obstacle and immediately changing direction without
considering long-term goals.
2. Deliberative Architecture
Uses symbolic reasoning to plan actions based on goals.
Maintains an internal representation of the environment.
More resource-intensive but capable of solving complex tasks.
Example: A chess-playing AI evaluating multiple moves to determine the best
strategy.
3. Layered Architecture
Combines reactive and deliberative approaches by organizing control into layers:
o Reactive Layer: Immediate responses.
o Deliberative Layer: Planning and decision-making.
o Executive Layer: Coordinates between reactive and deliberative layers.
Example: An autonomous car with:
A reactive layer for avoiding collisions.
A deliberative layer for planning routes.
An executive layer to switch between tasks.
4. Cognitive Architecture
Mimics human-like reasoning using psychological and neurological principles.
Emphasizes learning, memory, and decision-making.
Uses frameworks like SOAR or ACT-R.
Example: A personal assistant like Siri, which learns user preferences over time.
3. Explanation
The ability of an expert system to explain its reasoning process is critical for user trust
and debugging.
Key Features
1. Why Explanation:
o Explains why a specific question is being asked.
o Example: "Why are you asking about symptoms?" → "To determine the
type of illness."
2. How Explanation:
o Explains how a decision or conclusion was reached.
o Example: "How did you conclude the battery is dead?" → "Based on the
fact that the engine does not start and the battery voltage is low."
3. Traceability:
o Shows the sequence of rules applied to reach a decision.
4. Knowledge Acquisition
Knowledge acquisition involves gathering, organizing, and encoding domain
knowledge into the expert system.
Techniques
1. Manual Entry:
o Direct input of facts and rules by domain experts.
2. Automated Knowledge Acquisition:
o Use of machine learning to infer patterns and rules.
3. Interviews:
o Structured interviews with domain experts to extract their expertise.
4. Observation:
o Observing experts in action to understand decision-making processes.
5. Case-based Reasoning:
o Using past cases to derive solutions for similar problems.
Challenges
Tacit Knowledge: Experts may find it difficult to articulate their expertise.
Dynamic Knowledge: Knowledge evolves, requiring frequent updates.
Complexity: Large domains require extensive effort to encode knowledge.
Non-linear Planning
Non-linear planning allows handling multiple goals and actions concurrently, enabling
the creation of a plan that does not strictly follow a linear sequence. It uses:
Partial-order planning: Plans are represented as partially ordered steps.
Causal links: Ensure that specific preconditions are maintained.
Example:
Goals: on(A, B), on(B, C) Plan:
1. Move(A, Table)
2. Move(B, C)
3. Move(A, B) These steps can be reordered as long as dependencies are respected.
Hierarchical Planning
Hierarchical planning decomposes complex tasks into simpler sub-tasks:
High-level actions: Represent the abstract steps.
Refinement: Break down high-level actions into detailed plans.
Advantages: Simplifies problem-solving and improves scalability.
Example:
High-level goal: Arrange blocks as on(A, B), on(B, C) Steps:
1. Decompose: Achieve on(B, C) and on(A, B)
2. Solve subgoals as simpler problems.
Learning in AI
1. Learning from Examples: Learning patterns or rules from labeled examples.
Example: Training a classifier on labeled images to recognize cats and dogs.
2. Learning by Advice: The system improves performance based on external
advice (e.g., heuristic rules).
3. Explanation-Based Learning (EBL): Uses prior knowledge to generalize from
a single example.
Example: A chess program learns a winning strategy by analyzing a single
expert game.
4. Learning in Problem Solving: Learning heuristics or shortcuts to solve
problems more efficiently based on past experiences.
Decision Trees
A tree structure used for classification:
Nodes: Test attributes.
Branches: Attribute values.
Leaves: Decision outcomes.
Example:
Predict whether to play:
If Weather = Sunny and Humidity = High: No.
If Weather = Rainy: No.
Constructed tree:
Weather?
|-- Sunny --> Humidity?
|-- High --> No
|-- Normal --> Yes
|-- Rainy --> No
Would you like detailed coding examples or further elaboration?
Here's an explanation of the requested topics:
First-Order Logic
Advantages over Propositional Logic: Allows modeling of relationships and
quantified statements.
Example Usage: Representing "All humans are mortal" as
∀x(Human(x)→Mortal(x))\forall x (Human(x) \rightarrow Mortal(x)).
Let me know if you’d like a deeper dive into any specific topic!