Artificial Intelligence Flashcards
Branching factor
- Maximum number of successors of any node
- Denoted as b
Depth of shallowest goal node
Denoted as d
Maximum length of path
Denoted as m
Breadth first search
- Expands shallowest node on the frontier
- Complete if d and b are finite
- Optimal only if path cost is a nondecreasing function of a node depth, for example, if all actions have identical cost
- Time complexity: O(b^d)
- Space complexity: O(b^d)
Depth first search
- Expands deepest node on the frontier
- Complete if graph-search and finite state space. No if it’s used in a tree search.
- Not optimal
- Time complexity: O(bm)
- Space complexity: O(bm)
Iterative deepening search
- Run depth-first search to a fixed depth z
- Starting at z = 1, if the solution is not found then increment z and rerun the algorithm
- Time complexity: O(bd)
- Space complexity: O(bd)
- Complete if state space is finite
- Optimal if step costs are all identical
Uniform-cost search
- Expand node with lowest path cost
- Complete unless there is a path with an infinite sequence of zero-cost actions
- Optimal
- Time and space complexity: O(b^d) unless there are identical action costs, then it would be O (b^[1+ (C*/ϵ)]) with:
- C* = cost of the optimal solution
- ϵ = minimum action cost
Minimax algorithm
- Complete if game tree is finite
- Optimal against an optimal opponent
- Time complexity: O(bm)
- Space complexity: O(bm) or O(m)
Pruning decision trees
- Avoids over fitting to training data
- Reduces test error
- Reduces complexity of the final classifier
Greedy decision-tree learning
- Uses information gain to choose attributes to split on
- Does not prune
- Finds the decision tree that minimises error in the training data
Admissible heuristic
- Never overestimates the cost to reach the goal
- For example, straight line distance
- If non-negative then 0 ≤ h(I) ≤ action cost
Consistent heuristic
- Is also admissible
- h(n) <= c(n, a, nʹ) + h(nʹ)
Constraint satisfaction problem
- X = {X1,…,Xn} = set of variables
- D = {D1,..,Dn} = set of domains specifying the values each variable can take
- C = set of constraints that specifies values that the variables are allowed to have collectively
Q-learning
Formula to find new value: (γ p) + (α (r + (γ * p)))
- γ = discount factor
- p = previous value
- α = learning rate
- r = reward from previous turn
Given classes A and B:
- After transition A, perform action, B, the agent updates the Q value of state A
- After history A, perform action, B, the Q-value of state A changes
Greedy best-first search
- Expands the node that appears to be closest to goal.
- Complexity: O(b^m) for both for tree search but a good heuristic can reduce it substantially
- Complete only when performing graph search in finite state set otherwise no (it can get into loops).
A* search
- g(n) + h(n)
- g(n) = path cost from start node to node n
- h(n) = estimated cost of the cheapest path from n to goal state
- Complete
- Tree search version is optimal with an admissible heuristic
- Graph search version is optimal with a consistent heuristic.
- No other optimal algorithm is guaranteed to expand fewer nodes than A*
- Expands m nodes
Markov Decision Process
- S = set of states
- A(s), s ∈ S = set of actions available from each state
- P(s’ | s,a) = transition model
- R(s, a, s’) = reward function
Bellman’s Equation
s = state a = action s' = successor state
Bellman Optimality Equation
Value Iteration Update
Deterministic policy in MDP
At a state, one action is selected with total probability 1.
Interpretation in propositional logic
- Assignment of a truth value to each symbol (true/false)
- For example, for two symbols P and Q there would be 4 interpretations
Meaning in propositional logic
- A set of interpretations
Naive Bayes Classifier
- All features are conditionally independent of each other given their parent
- Features are mutually dependent of each other if they have the same parent