Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Mid Term Test

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Mid-Term Data Science

Name
ID:
Date:

Section A (20 marks)

For each of following questions find the best answer to the questions.

1. Which of these is not a regression problem?


a. Given input attributes temperature, pressure and geography predict rainfall in
cm
b. Given input attributes car capacity, mileage, average driving speed and age
predict the car insurance premium in $
c. Given input attributes salary, age, position, employment period and seniority,
predict salary increment in $
d. Given input attributes salary, age, credit history and employment history,
predict credit risk level (low, medium or high)
2. In a prediction problem we want to predict Y using Y ^ = f^ ( X ) . How is ^f estimated in
linear regression?
a. By finding the fit that minimizes the mean squared error
b. By finding the fit that minimizes the mean error
c. By finding the fit that the minimizes the total error
d. By finding the fit that minimizes the sum of all errors
3. Which of these statement is true for overfitting?
a. Overfitting refers to getting the best results in the test data
b. Overfitting refers to getting the best results only in the training data
c. Overfitting refers to a getting smaller test MSE (mean squared error)
d. Overfitting refers to minimizing MSE on both test and training data.
4. Which of these statement is true?
a. For best results we want low variance and low bias in the expected test MSE.
b. For best results we want low variance and low bias in the expected training
MSE.
c. Low variance is always better than low bias
d. Low bias is always better than low variance
5. What does variance refer to?
a. The differences in the test and training MSE
b. The mean differences in the test and training MSE
c. The amount by which the prediction would change if different training data set
is used
d. The amount the standard deviation changes in the test MSE in multiple training
sets.

1
6. Which of the following statements do not describe machine learning?
a. The field of study that gives computers the ability to learn without being
explicitly programmed.
b. A computer program is said to learn from experience E with respect to some
class of tasks T and performance measure P, if its performance at tasks in T, as
measured by P, improves with experience E.
c. A computer program is said to learn from some class of tasks T if it uses the
performance measure P to improve its experience E
d. Machine learning can be used to teach a computer to distinguish between
pictures of cats and dogs that it has not previously seen.
7. A statistic is a number calculated from the _____?
a. Parameter
b. Population data
c. Sample data
d. Mean population data
8. The naïve Bayes classifier is naïve because ___
a. It was invented by a naïve Bayes practitioner.
b. It assumes that the users are naïve.
c. It assumes that class labels are separable
d. It assumes the input attributes are independent
9. What is the purpose of having separate training and test data?
a. Training set is used to find the model parameters
b. Test set is used to find the model parameters
c. It is separated so that the machine uses less computing power
d. It is separated so that different models can be generated
10. Which of the following is not true?
a. Supervised learning requires a teacher
b. Unsupervised learning does not require a teacher
c. Supervised learning is a reinforcement learning problem
d. Clustering is a type of unsupervised learning

2
Section B (30 marks)

1. Explain whether each scenario below is a classification or regression problem (4


marks)

a. We collect a set of data on the top 500 firms in the US. For each firm we
record profit, number of employees, industry and the CEO salary. We are
interested in understanding which factors affect CEO salary. (2 marks)

b. We are considering launching a new product and wish to know whether it


will be a success or a failure. We collect data on 20 similar products that
were previously launched. For each product we have recorded whether it
was a success or failure, price charged for the product, marketing budget,
competition price, and ten other variables. (2 marks)

2. Provide some real-life applications for machine learning. (8 marks)


Example of a training sample:

Sepal length, Sepal width, Petal length, Petal width; Class (setosa, versicolor,
virginica)

(a) Describe one real-life applications in which classification might be useful.


Describe the response, as well as the predictors. Give a detailed example of a
training sample (see sample above). (4 marks)

3
(b) Describe one real-life applications in which regression might be useful. Describe
the response, as well as the predictors. Give a detailed example of a training
sample (see sample above). (4 marks)

3. Name 3 measures (or summary statistics) that we use to summarize distributions (6


marks)

4. Suppose there are two bowls of cookies. Bowl 1 contains 30


vanilla cookies and 10 chocolate cookies. Bowl 2 contains 20 of
each. (12 marks)

Bayes formula is given as: P ( Y |X ) =P ( X|Y ) P (Y )/P( X )

Now suppose you choose one of the bowls at random and,


without looking, select a cookie at random. The cookie is vanilla.

a. What is the probability that it came from Bowl 1? That is


calculate P ( B 1|V ). You can give the answer in fractions.

b. What is the probability that it came from Bowl 2? That is


calculate P ( B 2|V ). You can give the answer in fractions.

4
Section C (50 marks)

Use the Naïve Bayes classifier to learn P(Y|X) is to use the training data to estimate P(X|Y) and
P(Y). Then use these estimates together with Bayes rule above, to determine P(Y|X=x k) for any
new instance of xk

The fundamental equation of the Naïve Bayes classifier is:


n
P ( Y ) ∏ P( X i∨Y )
P ( Y |X 1 , … , X n )= i
n

∑ P ( Y j ) ∏i P( X i∨Y j )
j

Given a new instance X =⟨ X 1 ,… X n ⟩ this equation shows how to calculate the probability of Y
for the given X, provided that we can estimate P ( Y ) and P( X i∨Y ).

The Bayes Classifier determines Y by:


n
Y ❑ arg max P ( Y = y k ) ∏ P (X i∨Y = y k )
← yk i

The Dataset on Social media ads predict whether users have purchased a product (Yes class) by
clicking on the advertisements shown to them. The frequency counts are listed in each table.

Class Gender
Male Female Total
Yes 100 35 135
No 35 65 100
Total 135 100 235

Class Age
<22 23-30 >31 Total
Yes 20 30 85 135
No 50 25 25 100
Total 70 55 110 235

Class Salary
<15k 15001-60k >61k Total
Yes 20 25 90 135
No 25 50 25 100
Total 45 75 115 235

5
Based on the above data set, answer the following questions.

a. Estimate prior class probabilities. (4 marks)

b. Estimate the class conditionals probabilities of each attribute. You may fill up the table
below. (16 marks)

Class Gender
Male Female Total
Yes 135
No 100
Total 235

Class Age
<22 23-30 >31 Total
Yes 135
No 100
Total 235

Class Salary
<15k 15001-60k >61k Total
Yes 135
No 100
Total 235

c. Show your calculation and prediction for the following input data (30 marks)

Yes/No
1. Male Age=27 Salary=18k
2. Female Age=35 Salary=62k
3. Male Age=32 Salary=60k

You might also like