What is A* algorithm, function f(n)=g(n)+h(n)
The A* algorithm is a popular pathfinding and graph traversal algorithm that is often used in many fields of computer science due to its completeness, optimality, and optimal efficiency.
It uses the function f(n) = g(n) + h(n) where g(n) is the cost to reach the node and h(n) is the estimated cost to reach the goal from the node.
What is an Admissible heuristic?
An admissible heuristic is one that never overestimates the cost of reaching the goal, ensuring the optimality of the A* algorithm.
Admissible heuristics guarantee that the shortest path is found because they are optimistic in estimating the cost to reach the goal.
What are Propositional functions?
Propositional functions are logical statements that can be true or false depending on the values of their variables.
They are used in propositional logic to create complex logical expressions.
What is Propositional logic?
Propositional logic is a branch of logic that deals with propositions which can be either true or false.
It uses logical connectives like AND, OR, NOT to combine propositions into more complex expressions.
What is Abstraction in search-based problems?
Abstraction in search-based problems involves simplifying the problem by reducing its complexity, usually by ignoring some details.
This can make the problem easier to solve, while still retaining the essential features needed to find a solution.
What is Information gain?
Information gain is a measure used in decision trees to determine which feature to split the data on at each step.
It quantifies the reduction in entropy or uncertainty after the dataset is split on an attribute.
What is Python syntax?
Python syntax refers to the set of rules that define how a Python program is written and interpreted.
Python emphasizes readability and uses indentation to define code blocks instead of braces.
What is a Supervised learning algorithm?
A supervised learning algorithm is a type of machine learning algorithm that is trained on labeled data.
The algorithm learns to map inputs to outputs based on the labeled examples, making predictions on new, unseen data.
What is Breadth first search, Depth first search?
Breadth-first search (BFS) and Depth-first search (DFS) are fundamental graph traversal algorithms.
BFS explores all neighbors of a node before moving to the next level, while DFS explores as far as possible along a branch before backtracking.
What is Euclidean distance, Manhattan distance?
Euclidean distance is the straight-line distance between two points in Euclidean space. Manhattan distance is the sum of the absolute differences of their coordinates.
Euclidean distance is used for direct distance measurement, while Manhattan distance is used in grid-based pathfinding problems.
What is K-Means?
K-Means is a clustering algorithm that partitions the data into K distinct clusters based on feature similarity.
It iteratively assigns data points to clusters and recalculates cluster centroids until convergence.
What are States?
States represent the various configurations that a problem or environment can be in.
For example, in a chess game, each arrangement of pieces on the board is a state.
What is an agent? Give example
An agent is an entity that perceives its environment and takes actions to achieve its goals.
Example: A self-driving car that senses the road and navigates to a destination.
What is a Robot agent? Give example
A robot agent is a physical entity that interacts with the physical world.
Example: A Roomba vacuum cleaner that moves around the house cleaning floors.
What is a Software agent? Give example
A software agent is a program that performs tasks on behalf of a user.
Example: An email filter that automatically sorts incoming emails.
What is a Rational agent? Give example
A rational agent acts to achieve the best outcome or, when there is uncertainty, the best expected outcome.
Example: A chess-playing program that makes moves to maximize its chances of winning.
What is Single vs Multi agents? Give example
Single-agent systems involve one agent operating in the environment, while multi-agent systems involve multiple agents that may collaborate or compete.
Example: Single-agent - A standalone vacuum cleaner. Multi-agent - Autonomous cars in traffic interacting with each other.
What are the six agent types and explain them
The six types of agents are: Simple Reflex Agents, Model-Based Reflex Agents, Goal-Based Agents, Utility-Based Agents, Learning Agents, and Rational Agents.
- Simple Reflex Agents: Act on the current percept, ignoring the rest of the percept history.
- Model-Based Reflex Agents: Maintain an internal state based on the history of percepts.
- Goal-Based Agents: Act to achieve a specific goal.
- Utility-Based Agents: Act to maximize their own expected utility.
- Learning Agents: Improve their performance based on past experiences.
- Rational Agents: Always make the best decision given their knowledge.
What does PEAS stand for?
PEAS stands for Performance measure, Environment, Actuators, and Sensors.
It is a framework for specifying the setting in which an agent operates.
What four things does rationality depend on?
Rationality depends on: the performance measure that defines the criterion of success, the agent's prior knowledge of the environment, the actions the agent can perform, and the agent's percept sequence to date.
These factors determine the rationality of an agent's actions.
What is a fully observable environment? Give example
A fully observable environment is one where the agent has access to the complete state of the environment at each point in time.
Example: A chess game where all pieces and their positions are visible to both players.
What is a partially observable environment? Give example
A partially observable environment is one where the agent does not have access to the complete state of the environment.
Example: A card game where players cannot see each other's cards.
What is a Deterministic environment? Give example
A deterministic environment is one where the next state of the environment is completely determined by the current state and the action executed by the agent.
Example: A puzzle game where each move has a predictable outcome.
What is a Stochastic environment? Give example
A stochastic environment is one where the next state of the environment is not fully determined by the current state and the action executed by the agent.
Example: A dice game where the outcome is influenced by chance.
What is an Episodic environment? Give example
An episodic environment is one where the agent's experience is divided into episodes, and each episode consists of the agent perceiving and then performing a single action.
Example: An image classification task where each image is an episode.
What is a Sequential environment? Give example
A sequential environment is one where the current decision could affect all future decisions.
Example: A chess game where each move affects the subsequent moves.
What is a static vs Dynamic environment? Give example
In a static environment, the environment does not change while an agent is deliberating. In a dynamic environment, the environment can change while an agent is deliberating.
Example: Static - A chess game. Dynamic - A self-driving car in traffic.
What is a Discrete vs continuous environment? Give example
In a discrete environment, there are a finite number of possible states and actions. In a continuous environment, there are a potentially infinite number of states and actions.
Example: Discrete - A board game like chess. Continuous - The real world, such as controlling a robot arm.
What is a partial table and how do you make one? Give example
A partial table represents a subset of possible values or states in a truth table, often used to simplify expressions or focus on specific cases.
Example: Partial table for a logical expression (A AND B) might only include cases where A is true.
What is a truth table and how do you make one? Give example
A truth table is a mathematical table used in logic to compute the functional values of logical expressions based on their inputs.
Example: For a logical AND operation:
| A | B | A AND B |
|---|---|---|
| True | True | True |
| True | False | False |
| False | True | False |
| False | False | False |
What are states? Give example
States represent the various configurations that a problem or environment can be in.
Example: In a chess game, each arrangement of pieces on the board is a state.
What is an initial state? Give example
The initial state is the starting configuration of a problem or environment.
Example: In a maze-solving problem, the initial state is the starting position in the maze.
What is an action? Give example
An action is a possible move that changes the state.
Example: Moving a piece in a chess game.
What is a transition model? Give example
A transition model defines the outcome of each action in each state.
Example: In a robotic navigation problem, the transition model specifies the new position of the robot given its current position and movement command.
What is a goal test? Give example
A goal test determines whether a given state is a goal state.
Example: In a maze-solving problem, the goal test checks if the current position is the exit.
What is a path cost? Give example
Path cost is the total cost of a path from the initial state to the current state.
Example: In a routing problem, the path cost could be the sum of the distances of each segment of the route.
What are the five uninformed (blind) search strategies? Give example
The five uninformed search strategies are: Breadth-first search, Depth-first search, Uniform cost search, Iterative deepening search, and Bidirectional search.
Examples:
- Breadth-first search: Explores all nodes at the present depth before moving to the nodes at the next depth level.
- Depth-first search: Explores as far as possible along each branch before backtracking.
- Uniform cost search: Expands the least cost node.
- Iterative deepening search: Combines the benefits of depth-first and breadth-first search.
- Bidirectional search: Runs two simultaneous searches from the start and goal node and stops when they meet.
What is Breadth-first search?
Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures, starting from the root and exploring all nodes at the present depth level before moving on to nodes at the next depth level.
BFS is often used in finding the shortest path in unweighted graphs.
What are the properties of breadth-first search?
Properties of BFS:
- Complete: Yes, if the branching factor is finite.
- Time Complexity: O(b^d) where b is the branching factor and d is the depth of the shallowest solution.
- Space Complexity: O(b^d) as it stores all nodes at the current level.
- Optimal: Yes, if the cost is a non-decreasing function of the depth of the node.
BFS guarantees to find the shortest path in terms of the number of edges if each edge has the same cost.
What is Uniform cost search?
Uniform cost search (UCS) is a search algorithm that expands the least cost node first.
UCS is optimal and complete, often used for finding the shortest path in weighted graphs.
What are the properties of uniform cost search?
Properties of UCS:
- Complete: Yes, if the cost of every step is greater than or equal to a positive constant.
- Time Complexity: O(b^(1+C*/ε)) where C* is the cost of the optimal solution, b is the branching factor, and ε is the minimum edge cost.
- Space Complexity: O(b^(1+C*/ε)), similar to time complexity.
- Optimal: Yes, if step costs are all positive.
UCS is particularly useful when the cost to reach the goal is important, not just the number of steps.
What is Depth-first search?
Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures, exploring as far as possible along each branch before backtracking.
DFS can be implemented using recursion or a stack data structure.
What are the properties of depth-first search?
Properties of DFS:
- Complete: No, it may get stuck in an infinite loop.
- Time Complexity: O(b^m) where b is the branching factor and m is the maximum depth of the search tree.
- Space Complexity: O(bm) as it needs to store only a single path from the root to a leaf node, along with the remaining unexplored sibling nodes.
- Optimal: No, DFS may find a suboptimal solution if it does not explore the entire search space.
DFS is useful for problems where the solution is deep in the search tree and the search space is large.
What is Iterative deepening search?
Iterative deepening search (IDS) is an algorithm that repeatedly applies depth-first search with increasing depth limits.
IDS combines the space efficiency of DFS with the optimality of BFS.
What are the properties of iterative deepening search?
Properties of IDS:
- Complete: Yes.
- Time Complexity: O(b^d) where b is the branching factor and d is the depth of the shallowest solution.
- Space Complexity: O(bd) as it needs to store only a single path from the root to a leaf node, along with the remaining unexplored sibling nodes for each iteration.
- Optimal: Yes, if the path cost is a non-decreasing function of the depth of the node.
IDS is preferred when the depth of the solution is not known.
What is Bidirectional search?
Bidirectional search is a search algorithm that runs two simultaneous searches: one forward from the start node and one backward from the goal node, stopping when the two searches meet.
Bidirectional search can reduce the time complexity as it effectively halves the search depth.
What are the properties of bidirectional search?
Properties of Bidirectional Search:
- Complete: Yes, if both searches use a BFS strategy.
- Time Complexity: O(b^(d/2)) where b is the branching factor and d is the depth of the shallowest solution.
- Space Complexity: O(b^(d/2)) as it needs to store the nodes at the frontier of the search.
- Optimal: Yes, if both searches use BFS and the path cost is uniform.
Bidirectional search is useful when the goal state is known and there are efficient ways to generate predecessors of a state.
What is Machine learning? Give example
Machine learning is a field of artificial intelligence that uses statistical techniques to give computer systems the ability to learn from data and make decisions without being explicitly programmed.
Example: A recommendation system that suggests products based on previous user behavior.
What is Supervised learning? Give example
Supervised learning is a type of machine learning where the model is trained on labeled data, which means that each training example is paired with an output label.
Example: A spam detection system trained on emails labeled as "spam" or "not spam".
What is the labelled data of supervised learning? Give example
Labeled data in supervised learning refers to input data that is tagged with the correct output. The learning algorithm uses these labels to learn the mapping from input to output.
Example: Images of animals labeled with the corresponding animal name.
What is the classification and regression of supervised learning? Give example
Classification and regression are types of supervised learning. Classification predicts discrete labels, while regression predicts continuous values.
Example: Classification - Email spam detection. Regression - Predicting house prices.
What is Spam filtering?
Spam filtering is the process of identifying and separating spam emails from legitimate emails using machine learning algorithms and rule-based approaches.
Spam filters use features like email content, sender's reputation, and user feedback to classify emails.
What is labeled vs unlabeled data? Give example
Labeled data has been tagged with one or more labels identifying certain characteristics or categories, whereas unlabeled data has no such tags.
Example: Labeled data - Customer reviews with sentiment tags (positive/negative). Unlabeled data - Customer reviews without any sentiment tags.
What is a decision tree? Give example
A decision tree is a model used for classification and regression tasks that splits the data into subsets based on feature values, creating a tree-like structure of decisions.
Example: A decision tree for determining whether to play tennis based on weather conditions.
What is information gain as entropy reduction? Give example
Information gain measures the reduction in entropy or uncertainty about the dataset when a feature is used to split the data.
Example: In a dataset of weather conditions and playing tennis, information gain helps to determine which weather attribute best separates the data.
What is the binary classification of entropy?
Binary classification of entropy is a measure of the uncertainty or impurity in a dataset with two classes, often used in decision trees to evaluate splits.
Entropy is calculated as -p₁ log₂(p₁) - p₂ log₂(p₂), where p₁ and p₂ are the probabilities of the two classes.
What is the Gini index? Give example
The Gini index is a measure of statistical dispersion, representing the inequality of a distribution, often used to evaluate splits in decision trees.
Example: In a decision tree, a split with a lower Gini index indicates a better separation of classes.
What is Clustering? Give example
Clustering is a machine learning technique that groups a set of objects in such a way that objects in the same group (cluster) are more similar to each other than to those in other groups.
Example: Customer segmentation in marketing to identify distinct customer groups.
What is Cluster analysis? Give example
Cluster analysis is the process of partitioning a set of data into groups (clusters) such that data points within the same group are more similar to each other than to those in other groups.
Example: Market research to identify homogeneous groups of buyers.
What are some applications of clustering? Give example
Applications of clustering include market segmentation, social network analysis, image segmentation, and anomaly detection.
Example: Grouping similar news articles for topic discovery.
What are the types of clustering?
Types of clustering include:
- Hierarchical Clustering
- K-Means Clustering
- DBSCAN (Density-Based Spatial Clustering of Applications with Noise)
- Mean Shift Clustering
Each type has different use cases and advantages based on the data and the problem context.
What is K-Means? Give example
K-Means is a clustering algorithm that partitions data into K clusters, with each data point belonging to the cluster with the nearest mean (centroid).
Example: Segmenting customers into groups based on purchasing behavior.
What is the K-Mean algorithm? Give example
The K-Mean algorithm involves:
- Initializing K centroids randomly.
- Assigning each data point to the nearest centroid.
- Recomputing the centroids as the mean of the assigned points.
- Repeating the assignment and recomputation steps until convergence.
Example: Grouping products in a store based on sales data.
What are the centroid and objective functions using Euclidean distance?
In K-Means, the centroid is the mean of all points in a cluster, and the objective function is to minimize the sum of squared Euclidean distances between points and their respective centroids.
This minimization helps to ensure that data points within a cluster are as close as possible to each other.
What is Knowledge based systems (KBS)?
Knowledge-based systems (KBS) are computer programs that use artificial intelligence to solve complex problems by reasoning through bodies of knowledge, represented mainly as if-then rules.
These systems are used in various domains like medical diagnosis, financial services, and customer support.
What is the KBS architecture? Give example
The architecture of a KBS typically includes a knowledge base, an inference engine, and a user interface.
Example: A medical diagnosis system with a knowledge base of diseases and symptoms, an inference engine to apply logical rules, and a user interface for doctors to input symptoms and receive diagnoses.
What are Expert systems? Give example
Expert systems are a type of KBS designed to mimic the decision-making abilities of a human expert. They are used to solve specific problems within a particular domain.
Example: MYCIN, an early expert system for diagnosing bacterial infections and recommending antibiotics.
What are the applications of expert systems? Give example
Applications of expert systems include medical diagnosis, financial forecasting, customer support, and engineering diagnostics.
Example: An expert system used by customer support to provide solutions to common technical problems based on a knowledge base of past issues and solutions.