# Artificial Intelligence Exam 2019 ###### tags: `Exam` ## 1. Properties of Search Algorithm Which of the following search algorithms is guaranteed to find the optimal solution? * **Uniform Cost Search:** is optimal * **Breadth-First Search:** BFS is optimal only if cost is constant (the same for all actions); not optimal in general: it finds the solution with the shortest path * **Depth-First Search:** DFS is not optimal: will find “left-most” solution, not cheapest one * **Iterative Deepening Depth-First Search:** is optimal - like BFS * **Greedy Best-First Search:** Not optimal (heuristic may lead search to suboptimal solution first) * **$A^{*}$ Search:** If A* search is given a heuristic function $h(n)$ that is admissible, then $A^{*}$ search is optimal. If the heuristic function is admissible, meaning that it never overestimates the actual cost to get to the goal, $A^{*}$ is guaranteed to return a least-cost path from start to goal. --- ## 2. Logical Inference ![](https://i.imgur.com/JL2ZJPL.jpg) - Conversion KB to CNF: (A <=> B) ∧ (B => C) ∧ A (A => B) ∧ (B => A) ∧ (¬B ∨ C) ∧ A (¬A ∨ B) ∧ (¬B ∨ A) ∧ (¬B ∨ C) ∧ A We want to proof KB entails C so, apply resolution rule to CNF ∧ ¬C - Proof: from (¬A ∨ B) and (¬B ∨ C) follows (¬A ∨ C) from (¬A ∨ C) and (A) follows C from C and ¬C follows a contradiction So, C follows logically from KB --- ## 3. Probability and Bayesian Networks ![](https://i.imgur.com/T1TDdPY.jpg) ![](https://i.imgur.com/b3Fmq6Z.png) a) $P(c)\cdot P(\neg s |c)\cdot P(\neg r|c)\cdot P(w|\neg r \land \neg s) = 0.5\cdot 0.9\cdot 0.2\cdot 0.01 = 0.0009$ ![](https://i.imgur.com/IQkXTgA.png) b) $\alpha = \frac{1}{P(r,s)}$ $\alpha\dot (P(C,r,s,w)+P(C,r,s,\neg w))$ $P(\mathbf{X}|e) = \alpha P(\mathbf{X},e)=\alpha \sum_yP(X,e,y)$ ![](https://i.imgur.com/DRrnx9n.png) c) NEIN ![](https://i.imgur.com/F6MUonx.png) d)2^4. Why would it make sense to sample more events than are possible? --- ## 4. Concept Learning via Logistic Regression ![](https://i.imgur.com/DrOmttF.png) ![](https://i.imgur.com/qlochIx.png) a) The loss function for the logistic regression is the Binary Cross Entropy. ![](https://i.imgur.com/hIgxCbS.png) ![](https://i.imgur.com/hPqctCv.png) b) The output is between 0 and 1 and it can be interpreted as a probability for each class. If we want to have a decision, then we introduce a threshhold at $\hat{y}=0.5$ ![](https://i.imgur.com/5dcwmlD.png) ![](https://i.imgur.com/BJblJ43.png) --- ## 5. Reinforcement Learning ![](https://i.imgur.com/8mJS5Pp.jpg) ![](https://i.imgur.com/SL3EUZa.jpg) a) For some path (not optimal) we get:$\pi(A)=B, \pi(B)=D, \pi(D)=C \implies V^*(A)=60+60\cdot0.5+60\cdot0.25=105$ If we look at the optiam path (A->B->A->B->...) we get: $\pi(A)=B, \pi(B)=A \implies V_\pi=60\sum_{t=0}^\infty0.5^t >105$ ![](https://i.imgur.com/VR6V5X5.png) ![](https://i.imgur.com/CShpIdq.png) b) $r=60$ $\max_{a'\in\cal{A}}Q[B,a'] = 10$ $Q[A,\rightarrow] \leftarrow 60 + 0.5 \cdot 10 = 65$ ![](https://i.imgur.com/GizOnIu.png)