CS 662 Sample Midterm

Similar documents
Parsing with Context-Free Grammars

CS 188 Introduction to Fall 2007 Artificial Intelligence Midterm

Doctoral Course in Speech Recognition. May 2007 Kjell Elenius

CS 4100 // artificial intelligence. Recap/midterm review!

Chapter Finding parse trees

Chapter Finding parse trees

CS221 Practice Midterm

CISC4090: Theory of Computation

Parsing with CFGs L445 / L545 / B659. Dept. of Linguistics, Indiana University Spring Parsing with CFGs. Direction of processing

Parsing with CFGs. Direction of processing. Top-down. Bottom-up. Left-corner parsing. Chart parsing CYK. Earley 1 / 46.

CMPT-825 Natural Language Processing. Why are parsing algorithms important?

Informed Search. Day 3 of Search. Chap. 4, Russel & Norvig. Material in part from

CSE 473: Artificial Intelligence Spring 2014

Computational Linguistics II: Parsing

Review. Earley Algorithm Chapter Left Recursion. Left-Recursion. Rule Ordering. Rule Ordering

Introduction to Spring 2009 Artificial Intelligence Midterm Exam

CS1800: Strong Induction. Professor Kevin Gold

CKY & Earley Parsing. Ling 571 Deep Processing Techniques for NLP January 13, 2016

Informed Search. Chap. 4. Breadth First. O(Min(N,B L )) BFS. Search. have same cost BIBFS. Bi- Direction. O(Min(N,2B L/2 )) BFS. have same cost UCS

LECTURER: BURCU CAN Spring

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

Mock Exam Künstliche Intelligenz-1. Different problems test different skills and knowledge, so do not get stuck on one problem.

CS 4700: Foundations of Artificial Intelligence Homework 2 Solutions. Graph. You can get to the same single state through multiple paths.

10/17/04. Today s Main Points

Introduction to Fall 2008 Artificial Intelligence Midterm Exam

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

Homework 2: MDPs and Search

Introduction to Intelligent Systems: Homework 2

CS 188 Introduction to AI Fall 2005 Stuart Russell Final

Midterm Examination CS540: Introduction to Artificial Intelligence

Handout 8: Computation & Hierarchical parsing II. Compute initial state set S 0 Compute initial state set S 0

CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents

Knowledge-based Agents. CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents. Outline. Knowledge-based Agents

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

Introduction to Spring 2009 Artificial Intelligence Midterm Solutions

CSL302/612 Artificial Intelligence End-Semester Exam 120 Minutes

A* Search. 1 Dijkstra Shortest Path

Parsing. Based on presentations from Chris Manning s course on Statistical Parsing (Stanford)

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Logic. proof and truth syntacs and semantics. Peter Antal

Grammars and Context-free Languages; Chomsky Hierarchy

Midterm. Introduction to Artificial Intelligence. CS 188 Summer You have approximately 2 hours and 50 minutes.

CS 250/251 Discrete Structures I and II Section 005 Fall/Winter Professor York

Spectral Unsupervised Parsing with Additive Tree Metrics

AI Programming CS S-06 Heuristic Search

Adversarial Search & Logic and Reasoning

Context- Free Parsing with CKY. October 16, 2014

Introduction to Computational Linguistics

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Alpha-Beta Pruning: Algorithm and Analysis

Final. Introduction to Artificial Intelligence. CS 188 Spring You have approximately 2 hours and 50 minutes.

DT2118 Speech and Speaker Recognition

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

Artificial Intelligence

Midterm II. Introduction to Artificial Intelligence. CS 188 Spring ˆ You have approximately 1 hour and 50 minutes.

CTL satisfability via tableau A C++ implementation

Lecture Notes on Inductive Definitions

Context-Free Grammars and Languages. Reading: Chapter 5

CS 188: Artificial Intelligence Spring 2007

Natural Language Processing CS Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science

ECS 20: Discrete Mathematics for Computer Science UC Davis Phillip Rogaway June 12, Final Exam

Principles of AI Planning

Lecture Notes on Inductive Definitions

Natural Language Processing : Probabilistic Context Free Grammars. Updated 5/09

Sampling from Bayes Nets

Statistical Machine Translation

Hidden Markov Models, I. Examples. Steven R. Dunbar. Toy Models. Standard Mathematical Models. Realistic Hidden Markov Models.

Examination Artificial Intelligence Module Intelligent Interaction Design December 2014

Ch. 2: Phrase Structure Syntactic Structure (basic concepts) A tree diagram marks constituents hierarchically

AUTOMATED REASONING. Agostino Dovier. Udine, October 2, Università di Udine CLPLAB

1 Showing Recognizability

Lecture 12: Algorithms for HMMs

1 Functions, relations, and infinite cardinality

CISC681/481 AI Midterm Exam

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

Notes for Lecture Notes 2

Principles of AI Planning

Math 16 - Practice Final

CPSC 421: Tutorial #1

Minimax strategies, alpha beta pruning. Lirong Xia

Lecture 12: Algorithms for HMMs

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

TOC. Search Paradigms: And Tree Search. Formal Definitions. And-tree-based Search. Formal Definitions

Context Free Languages and Grammars

CS/ECE 374 Final Exam Study Problems Fall 2016

Deduction by Daniel Bonevac. Chapter 3 Truth Trees

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

Computational Models - Lecture 4

CS 380: ARTIFICIAL INTELLIGENCE LOGICAL AGENTS. Santiago Ontañón

Midterm II. Introduction to Artificial Intelligence. CS 188 Spring ˆ You have approximately 1 hour and 50 minutes.

Alpha-Beta Pruning: Algorithm and Analysis

Turing Machines Part Three

SOLUTION: SOLUTION: SOLUTION:

Better! Faster! Stronger*!

CS626: NLP, Speech and the Web. Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 14: Parsing Algorithms 30 th August, 2012

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Alpha-Beta Pruning: Algorithm and Analysis

Transcription:

Name: 1 True/False, plus corrections CS 662 Sample Midterm 35 pts, 5 pts each Each of the following statements is either true or false. If it is true, mark it true. If it is false, correct the statement so that it is true. Note: Adding not or otherwise negating the sentence is not acceptable. You must change the facts in the sentence if it is false. For example: Question: The Turing Test is a test of whether a computer program is rational. Bad answer, no credit: The Turing Test is not a test of whether a computer program is rational. Good answer: The Turing Test is a test of whether a computer program is indistinguishable from a human. A stochastic environment is one in which an action may have more than one result. True. A chart parser is more efficient than a top-down parser because it never backtracks. False. A Chart parser is more efficient because it caches partial solutions in a chart, thereby avoiding re-expending portions of the search tree. A rational agent is an agent that does what a human would do in any situation. False. A rational agent selects actions that maximize expected performance measure. A toy problem is a problem used to illustrate or study the performance of an algorithm. True. A complete algorithm is one that always finds all possible solutions to a problem. False. A complete algorithm is guaranteed to find a solution if one exists. A corpus is something that a vampire eats. False. A corpus is a collection of documents used to create a language model. A Goal-based agent selects actions that are likely to maximize its utility. False. A goal-based agent selects actions that will achieve its goal. 2 Agents and environments a. 24 pts, 6 pts each For each of the following agents and environments, characterize the environment according to the six properties used in R & N (static vs dynamic, discrete vs. continuous, fully vs. partially observable, deterministic vs stochastic, episodic vs. sequential, single-agent vs. multi-agent). If necessary, you may want to give a brief justification of your answers. The game of checkers. Static, discrete, fully observable, deterministic, sequential, multiagent.

An autopilot that successfully lands a plane. Dynamic, continuous, partially observable, stochastic, sequential, single-agent An handwriting recognition agent that reads the addresses on envelopes and places each of them in the appropriate mailbox. Static, discrete, fully observable, deterministic, episodic, single-agent A music-playing accompanist agent that can play along with a human piano player. Dynamic, continuous, partially observable, deterministic, sequential, multi-agent b. 6 pts Consider the following problem: We want to build an agent that can play word games. For our first task, we would like to build an agent that can recognize palindromes. (A palindrome is a word or phrase that reads the same backwards as forwards excpeting punctuation, such as Anna or Madam, I m Adam, or A man, a plan, a canal - Panama! ) Assume that our agent receives its input one letter at a time. That is, at time t=0 it sees a, and and time t=1 it sees n, and so on. Once the string is seen completely, the agent must output yes or no. Can a reflex agent solve this problem? If so, provide pseudocode for how such an agent might work. (You may use the back of the page if needed.) If not, explain precisely why it cannot solve this problem. No - a reflex agent has no memory. Recognizing a palindrome requires memorizing past characters to ensure that a particular pattern has been seen. For our second task, we want to build an agent that can find anagrams. That is, rearrangements of a phrase that are also a phrase. For example, scab can be rearranged to cabs, and artificial intelligence can be rearranged to make (among other things): Intergalactic lie? Fie! Nil! (punctuation added). Let s assume that we want to build a goal-based agent that will use search to find an anagram for an arbirtary input phrase. Your task in this problem will be to formulate the problem precisely enough so that it can be implemented. In grading this, I ll ask two questions. 1) Is the answer correct? 2) Could I write a program from this answer without any additional information? a) 4 pts Give an initial state for this search. An input string, and an empty output string. b) 4 pts Give a description of how a goal test could be implemented. Split the phrase on space and look up each word in a dictionary. If all letters are used and all words are in the dictionary, the goal is reached. c) 4 pts Describe what the successor function does. In other words, for a given input, what is produced? For a given index i, return n-i new strings with the letters at positions i and n-i exchanged. 3 Search a) (4 pts each) Give the time and space requirements in big-o terms for each of the following algorithms. Assume that the search tree has a branching factor of b, the solution is at depth d, and the tree has a maximum depth of n. Breadth-first search Time: O(b d+1 ), Space: O(b d+1 ) Depth-first search Time: O(b n ), Space: O(bn) Depth-limited search (depth = d) Time: O(b d ), Space: O(bd) Iterative deepening search Time: O(b d ), Space: O(bd)

b) 18 points - 6 points for each search Trace BFS, DFS, and A* on the following graph. Uninformed search methods should expand nodes from left-to-right. (B should be visited before C.) Both g1 and g2 are goal states; your algorithm may stop as soon as either is expanded. Show the order in which nodes are visited. For A*, also show the f,g, and h costs for each node visited. For A*, the costs for each edge are indicated next to the edge, and the heuristic costs for each state are in parentheses next to the state. A (8) 3 5 B (6) C (7) 2 4 7 D (3) E (4) F (2) 5 2 3 H (1) 2 G2 G1 BFS: A,B,C,D,E,F,H,G2 DFS: A,B,D,H,G1 A*: A [B (g = 3, h = 6, f = 9), C (g = 5, h = 7, f = 12)] B [D (g = 5, h = 3, f = 8), E (g = 7, h = 4, f = 11), C (g = 5, h = 7, f = 12)] D [*H (g = 10, h = 1, f = 11), *E (g = 7, h = 4, f = 11), C (g = 5, h = 7, f = 12)] H [E (g = 7, h = 4, f = 11), G1 (g = 12, h = 0, f = 12), C (g = 5, h = 7, f = 12)] E [H (g = 9, h = 1, f = 10), G1 (g = 12, h = 0, f = 12), C (g = 5, h = 7, f = 12)] H [G1 (g = 11, h = 0, f = 11), C (g = 5, h = 7, f = 12)] G1. Goal. Optimal Path: A, B, E, H, G1 (*) Note: E and H can be enqueued in either order since they have the same f-value. Both answers are correct.

4 Heuristics a. 4 pts Consider the Tower of Hanoi problem. There are three towers, with N disks of increasing size stacked on the leftmost tower. The problem is to move the disks from the left-hand to the right-hand tower, with the constraint that a larger disk can never be placed on top of a smaller disk. To begin, let h be the number of disks that still need to be moved. Is this heuristic admissible? If so, prove it. If not, provide a counterexample. Yes. Moving h disks requires 2 h 1 moves. This is larger than h for all h =0. b. 6 pts Next, consider the following heuristic: Number the disks according to size, where 1 is the smallest disk and n is the number of the largest disk. h is the sum of the numbers of each misplaced disk. Which heuristic should be used? Justify your answer with a precise technical argument, using the appropriate terminology. h2 dominates h1, so it should be used. (I ll leave the proof as an exercise.) 5 pts c. Use an admissibility argument to show that uniform cost search is optimal. We know that A* is optimal if it uses an admissible heuristic, which is a heuristic that always underestimates the distance to the goal. Uniform-cost search uses only path cost, and so the heuristic is always 0, which is less than or equal to the true cost.

5 Information Retrieval Consider a corpus of 10 documents that consists entirely of the following words and document frequencies: cat: 8 dig : 5 fish : 3 snail : 1 puppy: 10 artichoke: 2 kangaroo: 3 Suppose we have the following documents: d1: cat snail cat cat puppy kangaroo d2: fish fish cat kangaroo puppy snail a) For each word in d1 and d2, indicate their TFIDF scores. : d1: cat: 3 * log(10/8) = 0.96, snail: 1 * log(10/1) = 3.32, puppy: 1 * log(10/10) = 0, kangaroo: 1 * log(10/3) = 1.74 d2: fish: 2 * log(10/3) = 3.47, cat: 1 * log(10/8) = 0.32, kangaroo: 1 * log(10/3) = 1.74, puppy: 1 * log(10/10) = 0, snail: 1 * log(10/1) = 3.32 b) What is the cosine similarity between d1 and d2? numerator: 0.96 * 0.32 + 3.32 * 3.32 + 1.74 * 1.74 = 14.36 Denominator: 3.87 * 5.18 = 20.04 sim: 0.72

6 NLP Consider the following grammar and lexicon: S -> NP VP S -> S Conj S NP -> Noun Article Noun VP -> Verb Verb Adj Verb Adv Verb PP PP -> Prep NP Noun -> cat dog fish Article -> a the Verb -> sleeps is runs Adj -> happy sad Conj -> and but Prep -> with Adv -> quietly For each of the following sentences, show the parse tree. If the sentence cannot be represented by this grammar, write incorrect. 1. The cat is sitting incorrect 2. A fish sleeps quietly but a dog runs with a cat S S Conj S NP VP but NP VP ART N V ADV ART N V PP a fish sleeps quietly a dog runs Prep NP with ART N a fish 3. A dog is happy with a fish incorrect 4. A fish runs with a dog and a cat is happy S S Conj S NP VP and NP VP ART N V PP ART N V adj A fish runs Prep NP 5. the dog sleeps quietly with ART N a dog a cat is happy S NP VP ART N V ADV the dog sleeps quietly