CS Homework 2: Combinatorics & Discrete Events Due Date: September 25, 2018 at 2:20 PM

Similar documents
Chris Piech CS109 CS109 Final Exam. Fall Quarter Dec 14 th, 2017

The Naïve Bayes Classifier. Machine Learning Fall 2017

Introduction to Bayesian Learning. Machine Learning Fall 2018

Bayes Classifiers. CAP5610 Machine Learning Instructor: Guo-Jun QI

The Central Limit Theorem

COS 424: Interacting with Data. Lecturer: Dave Blei Lecture #2 Scribe: Ellen Kim February 7, 2008

Machine Learning. CS Spring 2015 a Bayesian Learning (I) Uncertainty

Math.3336: Discrete Mathematics. Combinatorics: Basics of Counting

Bayesian Learning. CSL603 - Fall 2017 Narayanan C Krishnan

Introduction to Machine Learning

P (A B) P ((B C) A) P (B A) = P (B A) + P (C A) P (A) = P (B A) + P (C A) = Q(A) + Q(B).

Introduction to Machine Learning

Probabilistic classification CE-717: Machine Learning Sharif University of Technology. M. Soleymani Fall 2016

1 The Basic Counting Principles

Be able to define the following terms and answer basic questions about them:

Modeling and reasoning with uncertainty

Basic Probabilistic Reasoning SEG

Fundamentals of Machine Learning for Predictive Data Analytics

13.4 INDEPENDENCE. 494 Chapter 13. Quantifying Uncertainty

Machine Learning

Machine Learning Linear Classification. Prof. Matteo Matteucci

Probability Review and Naïve Bayes

Bayesian belief networks

4. Conditional Probability

Be able to define the following terms and answer basic questions about them:

Data Mining: Concepts and Techniques. (3 rd ed.) Chapter 8. Chapter 8. Classification: Basic Concepts

With Question/Answer Animations. Chapter 7

Priors, Total Probability, Expectation, Multiple Trials

Generative v. Discriminative classifiers Intuition

Topic -2. Probability. Larson & Farber, Elementary Statistics: Picturing the World, 3e 1

A.I. in health informatics lecture 2 clinical reasoning & probabilistic inference, I. kevin small & byron wallace

Recall from last time: Conditional probabilities. Lecture 2: Belief (Bayesian) networks. Bayes ball. Example (continued) Example: Inference problem

CSC411 Fall 2018 Homework 5

CS 7180: Behavioral Modeling and Decision- making in AI

Naïve Bayesian. From Han Kamber Pei

From Bayes Theorem to Pattern Recognition via Bayes Rule

Lecture 10: Introduction to reasoning under uncertainty. Uncertainty

MLE/MAP + Naïve Bayes

Generative Learning. INFO-4604, Applied Machine Learning University of Colorado Boulder. November 29, 2018 Prof. Michael Paul

Topic 2 Probability. Basic probability Conditional probability and independence Bayes rule Basic reliability

CS6220: DATA MINING TECHNIQUES

Probability Experiments, Trials, Outcomes, Sample Spaces Example 1 Example 2

Learning with Probabilities

Ch 2: Probability. Contents. Fall 2017 UAkron Dept. of Stats [3470 : 451/551] Theoretical Statistics I

Challenges (& Some Solutions) and Making Connections

ECE 340: PROBABILISTIC METHODS IN ENGINEERING SOLUTIONS TO HOMEWORK #3

Q1 (12 points): Chap 4 Exercise 3 (a) to (f) (2 points each)

Naive Bayes classification

Machine Learning CSE546 Carlos Guestrin University of Washington. September 30, 2013

Chapter 6 Classification and Prediction (2)

Sheet 4 solutions. May 15, 2017

Bayes Formula. MATH 107: Finite Mathematics University of Louisville. March 26, 2014

Probabilistic Graphical Models Homework 2: Due February 24, 2014 at 4 pm

Conditional Probability. CS231 Dianna Xu

Parametric Models. Dr. Shuang LIANG. School of Software Engineering TongJi University Fall, 2012

STAT 201 Chapter 5. Probability

Probabilistic Classification

Computational Cognitive Science

Model Averaging (Bayesian Learning)

MLE/MAP + Naïve Bayes

Algorithm-Independent Learning Issues

Bayesian Reasoning. Adapted from slides by Tim Finin and Marie desjardins.

SUPERVISED LEARNING: INTRODUCTION TO CLASSIFICATION

Machine Learning, Fall 2012 Homework 2

CS Homework 3. October 15, 2009

Stat330 - Solution to Homework 2. 1 Kolmogorov. (c) For any two events A, B Ω, P (A B) = P (A) P (B). Because. and

Bayesian Learning. Artificial Intelligence Programming. 15-0: Learning vs. Deduction

Classifier Evaluation. Learning Curve cleval testc. The Apparent Classification Error. Error Estimation by Test Set. Classifier

Logistic Regression. Machine Learning Fall 2018

Probability and Statistics Notes

Probability Based Learning

COMPUTATIONAL LEARNING THEORY

Example. What is the sample space for flipping a fair coin? Rolling a 6-sided die? Find the event E where E = {x x has exactly one head}

Algorithmisches Lernen/Machine Learning

Topics. Bayesian Learning. What is Bayesian Learning? Objectives for Bayesian Learning

CMPSCI 240: Reasoning about Uncertainty

Probability. Chapter 1 Probability. A Simple Example. Sample Space and Probability. Sample Space and Event. Sample Space (Two Dice) Probability

BAYESIAN CLASSIFICATION

Discrete Mathematics and Probability Theory Fall 2015 Lecture 21

Bayesian Learning Features of Bayesian learning methods:

CS 2750: Machine Learning. Bayesian Networks. Prof. Adriana Kovashka University of Pittsburgh March 14, 2016

Introduction to Machine Learning

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Why Probability? It's the right way to look at the world.

HOMEWORK #4: LOGISTIC REGRESSION

can only hit 3 points in the codomain. Hence, f is not surjective. For another example, if n = 4

Lecture 04: Conditional Probability. Lisa Yan July 2, 2018

Lecture 2: Probability, Naive Bayes

Introduction: MLE, MAP, Bayesian reasoning (28/8/13)

Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 25. Minesweeper. Optimal play in Minesweeper

Naïve Bayes classification

Bayes Rule. CS789: Machine Learning and Neural Network Bayesian learning. A Side Note on Probability. What will we learn in this lecture?

Introduction to Machine Learning

More on conditioning and Mr. Bayes

Formal Modeling in Cognitive Science

COMP90051 Statistical Machine Learning

Section 4.2 Basic Concepts of Probability

Poisson distributions Mixed exercise 2

Formal Modeling in Cognitive Science Lecture 19: Application of Bayes Theorem; Discrete Random Variables; Distributions. Background.

Conditional Probability

Transcription:

CS1450 - Homework 2: Combinatorics & Discrete Events Due Date: September 25, 2018 at 2:20 PM Question 1 A website allows the user to create an 8-character password that consists of lower case letters (a-z) and digits (0-9), allowing repetition. (a) How many valid passwords are there where all the characters are letters? (b) How many valid passwords are there where all the characters are letters and are distinct (no repetition)? (c) How many valid passwords are there where the characters are all distinct and alternate between letters and numbers? Examples: 4a2d6g9f or b3t8z2k1 (d) How many valid passwords are there where all characters are distinct letters in alphabetical order? For example, abhikmno is allowed, but not bafgkmno. (e) How many valid passwords are there which contain only the letters a and b, and contain each of these letters at least once? (f) How many valid passwords are there which contain only the letters a and b, and contain an equal number of each letter? (g) Suppose a password is randomly generated using only letters from a-e and numbers from 0-4 (inclusive, with replacement). What is the probability that the password contains at least one letter and at least one digit? (h) A hacker writes a program that can test 1000 different passwords per second. John is bad at making passwords: all of his passwords contain the sequence john, and the rest of the characters are digits. If the hacker knows this, how much time (in seconds) would it take to test all possible passwords and (with certainty) hack John s account? Answer 1 1

Question 2 Consider a social network that allows accounts to be secured with a 6-digit passcode (any sequence of exactly six digits between 0-9 is valid). Assume the network has m users, including you, and that all users choose a valid 6-digit passcode uniformly at random. A user s passcode is considered safe if no other user has the same passcode. (a) As a function of m, what is the probability that your own passcode is safe? (b) How many users must there be for there to be a 50% or greater chance that your own passcode is not safe? (c) As a function of m, what is the probability that all users have a safe passcode? (d) How many users must there be for there to be a 50% or greater chance that at least one user s passcode is not safe? Answer 2 2

Question 3 In this problem, we will say that event A attracts event B if P(B A) > P(B), and event A repels event B if P(B A) < P(B). For simplicity, you may assume that the probability of all events is greater than zero. (a) Show that if A attracts B, then B must also attract A. (b) Show that if A neither attracts nor repels B, A and B must be independent. (c) Show that if A attracts B, then A repels B, where B is the complement of B. (d) Show that if A attracts B, then P(B A) > P ( B Ā). Answer 3 3

Question 4 Classifiers are of great use in diagnosing medical conditions based on symptoms. In this problem, you will consider a data set containing information about a set of patients (not a completely random sample of the population) who may or may not have heart disease. The data is split into two matrices, trainpatient and testpatient. Each row of these threecolumn matrices represents a patient. The first column contains the age of the patient in years. The second indicates whether exercise causes them to experience chest pain, with 1 indicating yes and 0 no. The third column is the ground truth of whether they have heart disease, again with 1 indicating yes and 0 no. trainpatient will be used to train your classifier by estimating various probabilities, and testpatient will be used to evaluate classifier performance, but not to estimate probabilities. To define a probabilistic model of this data, we let Y i = 1 if patient i has heart disease, and Y i = 0 if patient i does not. To construct a simple Bayesian classifier, we will compute the posterior probability P(Y i X i ) of the class label given some feature X i. If P(Y i = 1 X i ) > P(Y i = 0 X i ), we classify patient i as probably having heart disease. Otherwise, we classify them as probably not having heart disease. By Bayes rule, the posterior probability P(Y i X i ) is calculated as: P(Y i X i ) = P (X i Y i ) P(Y i ). P(X i ) Consider the feature A i, where A i = 1 if patient i has age > 55, and A i = 0 if patient i has age 55. (a) A simple way to estimate probabilities is by counting how many times each event occurs in the training data. Let N be the total number of patients, N 1 the number of patients with heart disease, N 1 A the number of patients with heart disease over age 55, N 0 the number of patients without heart disease, and N 0 A the number of patients without heart disease over age 55. We then set: P(Y i = 1) = N 1 N, P(Y i = 0) = N 0 N, P(X i = 1 Y i = 1) = N 1 A N 1 P(X i = 1 Y i = 0) = N 0 A N 0 Estimate these probabilities from the data in trainpatient, and report their values. (b) Test the Bayesian classifier based on feature A i using the data in testpatient. What is the accuracy (percentage of correctly classified patients) of this classifier on that data? (c) Consider now the feature E i, where E i = 1 if exercise causes patient i to experience chest pain, and E i = 0 if it does not. Estimate and report conditional probabilities for this new feature as in part (a). What is the accuracy of a Bayesian classifier based on feature E i on the data in testpatient? (d) Consider the pair of features {A i, E i }. This pair of features can take on 4 values: {0, 0}, {0, 1}, {1, 0} or {1, 1} (we do not assume that A i and E i are independent). By counting as in part (a), compute and report the probabilities of these four events given Y i = 1 and given Y i = 0. What is 4

the accuracy of a Bayesian classifier based on feature {A i, E i } on the data in testpatient? Compare the accuracy of this classifier to those from parts (b) and (c), and give an intuitive explanation for what you observe. Answer 4 5