Artificial Intelligence
Logical Agents
Knowledge-based agents
Logical AI:
The idea is that an agent can represent knowledge of its world,
its goals and the current situation by sentences in logic and decide
what to do by inferring that a certain action or
Machine Learning
Linear Models
Outline
II - Linear Models
1. Linear Regression
(a) Linear regression: History
(b) Linear regression with Least Squares
(c) Matrix representation and Normal Equation Method
(d) Iterative Method: Gradient descent
(e) Pros and
Artificial Intelligence
Conclusion
AI is a revolution
Just as the Industrial Revolution freed up a lot of humanity
from physical drudgery, I think AI has the potential to free
up humanity from a lot of the mental drudgery.
Andrew Ng.
Discussion question
H
COMS W3203-002
Homework 7 Solutions
assigned 20 Mar. 2017
due 27 Mar. 2017
1. 7.2 # 10 [8pts]
What is the probability of these events when we randomly select a permutation of the 26 lowercase letters of
the English alphabet? (Very) briefly explain your re
COMS W3203-002
Homework 1 Solutions
assigned 23 Jan. 2017
due 30 Jan. 2017
Remember to.
put your name and UNI at the top!
put the name(s) of your teammate(s) at the top!
show your work and explain your reasoning, for that is the stuff partial credit is
COMS W3203-002
Homework 4 Solutions
assigned 13 Feb. 2017
due 20 Feb. 2017
1. 4.1 # 40 [4pts]
Prove that if n is an odd integer then n2 1 (mod 8).
If n is odd, then n = 2k + 1 for some integer k. This gives us n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 4k(k +
1) +
COMS W3203-002
Homework 6 Solutions
assigned 06 Mar. 2017
due 20 Mar. 2017
1. 6.1 # 50 [7pts]
How many bit strings of length 10 contain either five consecutive 0s or five consecutive 1s?
First we find the number of strings that contain five conscutive 0s.
COMS W3203-002
Homework 3 Solutions
assigned 06 Feb. 2017
due 13 Feb. 2017
1. Ch 3.1 # 42 [5pts]
The selection sort begins by finding the smallest element in the list. This element is moved to the front. Then
the smallest element among the remaining eleme
COMS W3203-002
Homework 2 Solutions
assigned 30 Jan. 2017
due 06 Feb. 2017
Remember to.
put your name and UNI at the top!
put the name(s) of your teammate(s) at the top!
show your work and explain your reasoning, for that is the stuff partial credit is
COMS W3203-002
Homework 5 Solutions
assigned 27 Feb. 2017
due 06 Mar. 2017
1. 5.1 #46 [10pts]
Use mathematical induction to prove that a set with n elements, where n is an integer greater than or equal
to three, has n(n1)(n2)
subsets containing exactly th
COMS W3203-002
Homework 8 Solutions
assigned 03 April 2017
due 10 April 2017
1. 8.1 # 6 [9pts]
Consider the strictly increasing sequences of positive integers that have 1 as their first term and n as their last
term, where n is a positive integer, ie. seq
COMS W3203-002
Homework 9
assigned 10 Apr. 2017
due 17 Apr. 2017
1. 9.1 # 22 [6pts]
A relation R is called asymmetric if (a, b) R implies that (b, a) 6 R.
Must an asymmetric relation also be anti-symmetric? Must an anti-symmetric relation be asymmetric? B
COMS W3203-002
Homework 10 Solutions
assigned 17 Apr. 2017
due 24 Apr. 2017
1. 10.2 # 54 [4pts]
A simple graph is regular if every vertex of this graph has the same degree.
For which values of m and n is the complete bipartite graph Km,n regular? Briefly
14 - Lecture - Sockets and HTTP
-Sockets API
-Recommended reading:
Beejs Guide to Network Programming
Chapter 2: What is a socket?
Chapter 3: IP Addresses, structs, and Data Munging
Chapter 5: System Calls or Bust
- available online: http:/beej.us/guide/b
BINARY NUMBERS, BOOLEAN LOGIC, GATES
- For textual information, 8 bits are used to store a
character. The most widely used code for representing
characters is ASCII.
- With 8 bits, there are 256 (2^8) different
characters.
- The code set Unicode uses a 16
DEFINITIONS
accessor method: a method that accesses an object but does not change it (its instance variables)
actual parameter: a value that is passed into a method by a caller (the user); also known as an
argument of a method
address: a unique identifier
Chapter 4
Number Types
In Java, every value is either a reference to an object, or it belongs to one of
the eight primitive types.
Primitive Types
Type
Description
Size
int
The integer type, with range
4 bytes
2,147,483,648 (Integer.MIN_VALUE) . . .
2,147
1.
Consider the integer array
3
1
5
2
7
6
4
Using the Insertion Sort algorithm, how many comparisons between elements have to be made before
the array is sorted into increasing order?
a) 7
b) 12
c) 14
d) 21
e) 49
2.
Consider the integer array
5
4
5
3
4
3
Big Java Early Objects (Horstmann)
Chapter 1
1) The Java Programming Language
a) Java has a rich library that can be used to write portable programs
that can bypass proprietary (relating to an owner) operating systems.
b) Java has two attributes that make
Chapter 5
the if Statement
if (floor > 13)
cfw_
actualFloor = floor - 1;
else
cfw_
actualFloor = floor;
Java has a conditional operator of the form
condition ? value1 : value2
The value of that expression is either value1 if the test passes or value2 if
Chapter 3
INSTANCE VARIABLES
Whenever the operator clicks the button of a tally counter, the counter value
advances by 1.
We model this operation with a click method of a Counter class.
A physical counter has a display to show the current value.
In our si
Answers:
1. b) 12
We compare 1 with 3 (+1 comparison), then 5 with 3 (+1), then 2 with 5, 1, and 3
(+3), then 7 with 5 (+1) , then 6 with 7 and 5 (+2), then 4 with 7, 6, 5, and 3 (+4).
2. d) 15
The number of comparisons is always n ( n - 1) / 2, so 6 (6 -
Graphs (two collections)
G = (v, E)
v = vertices/nodes; set
E = pairs of connections
BST and LinkedList are special cases
E is a pair of vertices
E = (v1, v2) members of set, v
Weighted/unweighted value to represent it, or just be there or not
Dir
Trees
Roots with branches that stem off it (e.g. family tree)
Nodes that stem to other nodes
To define it recursively: a root can have 0 or more subtrees
root
T1
T3
node
T2
A
edge
C
B
D
We talk going
down a tree for
paths not up.
Height of a node
length
Insertion sort: O(n2) worst case
Heap sort: O(n log n) worst case, good and consistent in comparison to Merge Sort
Inversion Based Sorting Algorithms cannot do better than n2 in the worst case (lower bound)
Selection Sort
Picks min, puts it at the beginn
Euler Path
a path through an undirected graph that visits every edge exactly once
Can pass through vertex more than once
Euler circuit path that begins and ends at the same vertex
Once we enter v, we need another edge to leave it
If v has an odd numb
Connectivity An undirected graph is considered connected if there is a path from one vertex to
all other vertices
Biconnectivity there is no such vertex v, such that the removal of v will disconnect the
remaining graph
Articulation points vertices at wh
Order is no longer FIFO, based on importance
There is a sign, importance for the data passed in, is inserted with the value
Organized in a way that the most important thing comes out first
Example: OS, priority of single processing system and so the pr