Clustering, k-means, k-means+ and
the advantages of careful seeding
Boston University Slideshow Title Goes Here
David Arthur, Sergei Vassilvitskii. k-means+: The
Advantages of Careful Seeding. In SODA 2007
What is clustering?
a grouping of data objects
6-Clustering-Overview
September 27, 2016
1
Clustering
1854: Cholera outbreak in Soho, London.
Common wisdom at the time was that disease spread by breathing foul air (miasma).
In 10 days, 500 people in the area died.
John Snow: local physician.
Sewer syst
Hierarchical Clustering
Hierarchical Clustering
Produces a set of nested clusters organized as a
hierarchical tree
Can be visualized as a dendrogram
A tree-like diagram that records the sequences of merges
or splits
S
CS 131A
Snapshot 25th October
Snapshot 25th October
Mini Assignments:
Snapshot 25th October
Mini Assignments:
Assignment1 and Assignment2: Marks are on BB
Snapshot 25th October
Mini Assignments:
Assignment1 and Assignment2: Marks are on BB
Assignment3: Cu
CS131A
Complexity of Algorithms
Snapshot 8th November
Snapshot 8th November
Mini Assignments:
Snapshot 8th November
Mini Assignments:
Assignment1, Assignment2, Assignment3: Marks are on BB
Snapshot 8th November
Mini Assignments:
Assignment1, Assignment2,
CS 131A
Logic and Proofs
Snapshot 4th October
Snapshot 4th October
Mini Assignments:
Snapshot 4th October
Mini Assignments:
Assignment1:
Snapshot 4th October
Mini Assignments:
Assignment1:
Will be handed out during lab. Marks are on BB.
Snapshot 4th Octob
CS 131A
Mathematical Induction
Review of Fibonacci Numbers
and Mathematical Induction
Basics of Set
Two sets are equal if and only if they have the
same elements.
A=B
8x[x 2 A $ x 2 B]
A set A is a subset of a set B if and only if
everything in A is also
CS131A
Complexity
Snapshot 1st November
Snapshot 1st November
Mini Assignments:
Snapshot 1st November
Mini Assignments:
Assignment1 and Assignment2: Marks are on BB
Snapshot 1st November
Mini Assignments:
Assignment1 and Assignment2: Marks are on BB
Assig
CS 131A
Mathematical Induction
Snapshot 18th October
Snapshot 18th October
Mini Assignments:
Snapshot 18th October
Mini Assignments:
Assignment1 and Assignment2: Marks are on BB
Snapshot 18th October
Mini Assignments:
Assignment1 and Assignment2: Marks ar
CS 131A
Growth of Functions
Algorithms
Algorithms
In CS 112 and CS 111, you are writing algorithms:
Algorithms
In CS 112 and CS 111, you are writing algorithms:
Algorithms solve a variety of problems:
Algorithms
In CS 112 and CS 111, you are writing algor
Problem Set 1 Solutions
October 2016
1. (a)
(b)
(c)
(d)
(e)
y(C(y) A(y)
S(Lois, Pirates of the Caribbean) L(Lois, Pirates of the Caribbean)
xy(C(y) S(x, y)
xy(S(x, y) L(x, y)
y(S(Ben, y) A(y)
2. (a) Let h be she is a History major, g be she is a Geography
Mini assignment 2 Solution
October 2016
1
problem 1
1.1
a
e(x): x is enrolled in university.
d(x): x lived in a dormitory
By Universal instantiation x(e(x) > d(x).
We also know d(M ia).
Therefore by modus tollens, e(M ia) is true.
1.2
b
c: convertible car
Pigeonhole Principle
The following general principle was formulated by the famous German mathematician Dirichlet
(1805-1859):
Pigeonhole Principle: Suppose you have k pigeonholes and n pigeons to be placed in them. If
n > k (# pigeons > # pigeonholes) the
CS 131
Mathematical Induction
Proof by Cases
Proof by Cases
Prove that x+ | x
7|
7 for all real numbers x
Proof
by
Cases
Prove that x+ | x 7 | 7 for all real numbers x
Proof by Cases
if x is a real number such that
then either x > 1 or 2 < x < 1
x2 1
x+2
CS 131 Fall 2016 Lab 9
Question 1 Suppose that:
A=
a 0
0 b
where a and b are real numbers. Show using mathematical induction that:
n
a
0
An =
0 bn
Question 2 Suppose that A and B are square matrices with the property that AB = BA. Show using
mathematical
CS 131 Fall 2016 Lab 6
Question 1 #12 in 5.2 (p. 342)
Use strong induction to show that every positive integer n can be written as a sum of distinct powers of
two, that is, as a sum of a subset of the integers 20 = 1, 21 = 2, 22 = 4, and so on.
Question 2
CS 131A
Complexity and Solving Recurrence Relations
Growth of Combinations of
Functions
Many algorithms are made up of two or more
separate sub procedure.
The number of steps used by this algorithm is
the sum of the number of steps used by these
procedure
CS 131A
InClass Practice Problems
Done in Pairs
October 20, 2016
1. Prove that f12 + f22 + . + fn2 = fn fn+1 where n is a positive integer
2. Prove that f1 + f3 + . + f2n1 = f2n where n is a positive integer
3. Show that fn+1 fn1 fn2 = (1)n where n is a p
CS 131A
Combinatorics
Combinatorics
Combinatorics is the study of arrangements of
objects, and is an important part of discrete
mathematics.
Enumeration the counting of objects with certain
properties is an important part of combinatorics.
We must count o
Azu Eleonu
Combiatric Structures
Professor Attarwala
15 November 2016
Problem Set 2
AN 0
N
1. PROPOSITION P(N): Prove A =
N
0 B
A0
BASIS STEP P(1) = when n = 1; A1 =
, so the basis is true.
0B
INDUCTIVE HYPOTHESIS: Assume P(N) and P(1) is true.
INDUCTIVE
CS 131A
Help Session for MidtermExam2
1. What is the worst case complexity of the following algorithm?
int cost (int n) cfw_
int i,j,temp=0;
for (i=0;i<n;i+)
for (j=0; j<i; j+) temp+;
return temp;
2. What is the worst case complexity of the following alg
n
2. Use the Principle of Mathematical Induction to prove that 2n + 3 2 when n 4.
n
PROPOSITION P(N) = prove that 2n + 3 2 when n is an integer greater than or equal 4.
BASIS STEP P(5) = 2(5) + 3 < 25
P(5) = 10 + 3 < 32
P(5) = 13 < 32, therefore the basis
QUIZ REVIEW
1. Use and mathematical induction to show that l(wi) = i l(w), where w is a string
and i is a non negative integer. The function l is the length function of a string as
defined in lecture.
a. PROPOSITION P(i): Prove that l(wi) = l * l(w).
b. B
DIRECT PROOF EXAMPLES:
Show that the additive inverse, or negative, of an even number is an even number
using a direct proof.
X = 2k, whereas k is an integer in the field of real numbers,
-X = -2k, whereas -2k is the inverse of k.
-X = -2k = 2(-k)
j = -k,
Permutations and Combinations
CS 131 Fall 2016
Hannah Flynn
November 15, 2016
Hannah Flynn
Permutations and Combinations
Recall the Product Rule
Product Rule: Suppose that a procedure can be broken into a
sequence of two tasks. If there are n1 ways to do
Azu Eleonu
Combiantric Structures
Professor Attarwala
3 November 2016
Mini-Assignment 4
1)
A. Reversal of Strings:
a. 1010
b. 1101 1
c. 1110 1001 0001
B. RECURSIVE DEFINITION
a. Base: R() =
R() =
b. Recursive:
R(w) = R(w )
w = w
= * R(w)
c.
d.
e.
f.
C.
CS 131A
Name:
Abbas Attarwala
Course Expectation:
Discrete Math! Never took it in high school and Im very excited too!
Computer Science extra component: what am I going to gain in the future
LATE
Office Hours:
Teusday
Wednesday
Thursday
Discrete Mathe
CS 131A
InClass Practice Problems
Done in Pairs
September 27, 2016
1. What is wrong with this argument? Let H(x) be x is happy. Given the premise xH(X), we conclude
that H(Lola). Therefore, Lola is happy.
2. Justify the rule of universal modus tollens by
1. Use the definition of f(x) to show that 2X + 17 is O(3X)
2X + 17 < C * 3X
2X + 17 < 2x + 2x; x > 5 = 2 * 2X
2X + 17 < C * 3X for all x > 5
2X + 17 is O(3X).
2. Show that ( (x2 + 1)/(x + 1) ) is O(x).
(x2 + 1)/(x + 1)x < c
(x2 + 1)/(x2 + x) < c
(2x/ x2