Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

DATA 8

Spring 2022

Foundations of Data Science

FINAL ExAM

1. (28.0 points) True or False

(a) (2.0 pt) The slope and intercept that result from minimizing the mean squared error are always the same as the slope and intercept that result from minimizing the root mean squared error.

○ True

○ False

(b) (2.0 pt) In order to build a k nearest neighbors classifier, you do not need to know the class value of any of the training examples.

○ True

○ False

(c) (2.0 pt) A classifier is considered to be overfitting if it performs very well on the training set, but not very well on the test set.

○ True

○ False

(d) (2.0 pt) If I am using Home Price and Household Income (both in US dollars) as two features for my classifier, I do not need to standardize them since they have the same units.

○ True

○ False

(e) (2.0 pt) Entering your name and birthday when signing up for the Chipotle rewards program is an example of inference (in terms of data privacy).

○ True

○ False

(f) (2.0 pt) Suppose you have a set of points (x, y) with the mean of x being 10 and the mean of y being 8.

If you perform linear regression on this dataset, the confidence interval for the height of the regression line at x = 9 will be narrower than the corresponding confidence interval at x = 18.

○ True

○ False

(g) (2.0 pt) In linear regression, slope is always measured in the same units as intercept.

○ True

○ False

(h) (2.0 pt) According to the Central Limit Theorem, if a sample is large, and drawn at random from the population with replacement, then the probability distribution of the sample average is roughly normal.

○ True

○ False

(i) (2.0 pt) For any distribution, the percent of data that lies within 2 SDs of the average is at least 75% and at most 95%.

○ True

○ False

(j) (2.0 pt) The median of a set of 25 integers will always be an integer.

○ True

○ False

(k) (2.0 pt) Suppose a hypothesis test is proposed and we already know that the null hypothesis is true. If 100 researchers each independently collect a large random sample of the same size to carry out an experiment and they all use 5% as their p-value cutoff, we should expect around 5% of them to reject the null.

○ True

○ False

(l) (2.0 pt) The chance of an event happening is always the number of outcomes that make the event happen, divided by the total number of possible outcomes.

○ True

○ False

(m) (2.0 pt) If we use linear regression to predict y-values based on our x-values, the average of our residuals will always be zero.

○ True

○ False

(n) (2.0 pt) Given a function error(a,  b,  c,  d) which computes some error based on its input arguments,

a valid output from the call minimize(error) could be an array containing two elements: 25 and 4.

○ True

○ False

2. (22.0 points) Shorts

UBA, a media company based in New York, wants to start integrating Youtube videos into its morning show.

To evaluate some propsects, Cory, the CEO, puts together a table called videos that contains a random sample of Youtube videos published in the last year. The rst few rows are shown here:

Name

ID

Views

#Shorts

Date

INSANE strawberry trick! #Shorts

UC6D1L2vxEAg

329461822

True

05-08

Adele - Easy On Me (Ocial Video)

UComP_epzeKz

272980726

False

10-14

BTS () ‘Permission to Dance

UC3IZKseVp

480881920

False

07-09

BTS () ‘Butter

UC3IZKseVp

746499500

False

05-20

The table has the following columns:

Name :  (string) the videos name

ID : (string) the channel s ID in Youtubes database

Views :  (int) the number of times the video has been watched

#Shorts:  (bool) whether the video is a short

Date :  (string) the month and day the video was published

(a) (3.0 pt) Complete this Python expression, which evaluates to the name of the most watched video.

videos ._________ .item(0)

(b) (4.0 points)

Complete this Python expression, which evaluates to an array with two items (in any order): the average number of views for #Shorts and the average number of views for non-#Shorts.

videos ._________ (_________) ._________ ( !Views  average !)

(a)              (b)                (c)

i. (1.0 pt) Which of these could ll in blank (a)?

○ sort

○ where

○ group

ii. (2.0 pt) Fill in blank (b).

iii. (1.0 pt) Which of these could ll in blank (c)?

○ select

○ take

○ column

(c) (3.0 pt) Complete this Python expression, which visualizes the distribution of the number of views for

videos with names that include a # character (i.e. a hashtag).

videos ._________

Recall : The videos table has columns Name, ID,  Views, #Shorts, and Date.

(d) (4.0 points)

Complete this Python expression, which visualizes the distribution of the counts of #Shorts vs. non-#Shorts, including only videos that have more than 10,000 views.

videos .where(_________) ._________ ._________

(a)                (b)              (c)

Recall : The videos table has columns Name, ID,  Views, #Shorts, and Date.

i. (2.0 pt) Fill in blank (a).

ii. (1.0 pt) Which of these could ll in blank (b)?

○ column( !#Shorts !)

○ column( !Views !)

○ pivot( !#Shorts ! ,  !Views !)

○ pivot( !Views ! ,  !#Shorts !)

○ group( !Views !)

○ group( !#Shorts !)

iii. (1.0 pt) Which of these could ll in blank (c)?

○ hist( !count !)

○ hist( !#Shorts !)

○ hist( !Views !)

○ barh( !#Shorts ! ,  !count !)

○ barh( !Views ! ,  !count !)

(e) (3.0 pt) Complete this Python expression, which evaluates to a table with one row for each unique date

and three columns: the date, as well as the total number of views of #Shorts and non-#Shorts videos on that date. Any column labels are acceptable.

videos ._______________

Recall : The videos table has columns Name, ID,  Views, #Shorts, and Date.

(f) (5.0 points)

Corys colleague Bradley notices that the videos table doesnt contain the names of the channels.

Bradley creates an additional table called channels that contains all Youtube channels and has two columns:

Identier :  (string) the channels ID in Youtubes database

Channel :  (string) the channels name

Bradley suspects that channels with exactly 4 characters in their name such as Vevo could be good channels to partner with since even their lowest performing videos have many views.

Complete her code, which assigns min_views to the minimum number of views received by a video posted to a channel with a 4-character name.

Hint: Calling len on a string returns the number of characters in the string.

channels  =  channels .with_column( !Name  Length! ,  _________)

(a)

min_views  =  np .min(videos ._________ .where( !Name  Length!,  4) ._________)

(b)                                                              (c)

Recall : The videos table has columns Name, ID,  Views, #Shorts, and Date.

i. (2.0 pt) Fill in blank (a).

ii. (2.0 pt) Fill in blank (b).

iii.(1.0 pt) Fill in blank (c).

3. (26.0 points) Supes

Hughie and Kimiko are investigating the Supes, a group of paid superheroes. On a regular basis, the Supes are alerted by emergencies in their area and try to arrive on the scene as fast as possible to save the day.

To get a sense of the Supesspeed, Hughie plans to randomly sample response times from public records.

(a) (2.0 pt) Suppose that Hughie wants to randomly sample 100 Supe response times to create a confidence interval for the population mean of Supe response times.

Which of the following could be used to help him create such a condence interval?  Select all that apply.

o A/B Testing

o Bootstrapping

o Classification

o Central Limit Theorem

o None of the above

(b) (2.0 pt) Suppose Hughie wants to randomly sample Supe response times to create a 95% confidence interval for the population median of response times, and he knows that the population SD is 40 seconds.

What is the minimum sample size he needs to create a condence interval that has a width of 8 seconds?

○ 3200

○ 1600

○ 800

○ 400

○ 200

○ 100

○ 40

○ 8

○ There is not enough information to answer

(c) (2.0 pt) Suppose Hughie wants to randomly sample Supe response times to create a 95% confidence interval for the population mean of response times, and he knows that the population SD is 20 seconds.

What is the minimum sample size he needs to create a condence interval that has a width of 4 seconds?

○ 3200

○ 1600

○ 800

○ 400

○ 200

○ 100

○ 20

○ 4

○ There is not enough information to answer

(d) (4.0 pt) Suppose that Hughie randomly samples 100 Supe response times and uses the Central Limit Theorem to create a 95% confidence interval for the population mean Supe response time, which he finds is (450, 550).

Which of the following can be concluded from the condence interval above?

Select all that apply.

o If Hughie’s friend Kimiko repeats this process 500 times, she can expect that roughly 95% of the intervals she creates will contain the true population mean.

o If Hughie randomly samples 1,000 response times without replacement, he can expect roughly 95% of the Supe response times to be between 450 and 550 seconds.

o 95% of Supe response times in the population are between 450 and 550 seconds.

o The average Supe response time in Hughie’s sample was exactly 500 seconds.

o None of the above.

(e) (4.0 pt) Hughie suspects that the Supes’ average response time is slower than the 7 minute (420 seconds) average response time for local law enforcement.

Based on a 95% condence interval for the population mean Supe response time of (450, 550) seconds,

if his p-value cutois 1%, what should he conclude?

Select all that apply.

o The data are consistent with the hypothesis that Supes respond to emergencies more slowly than local enforcement do.

o The data are consistent with the hypothesis that the distribution of the emergency response times is the same for both the Supes and local law enforcement.

o The data are consistent with the hypothesis that the Supes respond to emergencies more quickly than local enforcement do.

o There is not enough information to make any of these conclusions.

(f) (3.0 pt) Suppose that Kimiko creates her own random sample of 100 Supe response times. She observes a

sample average of 450 seconds for response time and she also knows that the population SD is 20 seconds. What is her 95% confidence interval for the true population mean of Supe response time (in seconds)?

(446, 454)

(448, 452)

(449.6, 450.4)

(449.8, 450.2)

(460, 540)

(480, 520)

○ None of the above.

(g) (3.0 pt) Suppose that Kimiko creates two different random samples of 100 Supe response times and constructs a 95% confidence interval for the true population mean of Supe response time using each one. What is the chance that at least one of them contains the population mean?

(h) (6.0 points)

Suppose Kimiko tries to predict the emergency response time of the Supes from each of the following four different variables:

Income :  (float) the average income in the emergency locations neighborhood

Distance :  (float) the distance in miles from the emergency location to their headquarters

●  Crimes :  (int) the average weekly number of crimes reported in the emergency location’s neighborhood last year

●  Height:  (float) the average building height (in feet) in the emergency location’s neighborhood To assess her predictions from each variable, she creates the following residual plots:

i. (2.0 pt) Which of the plots above indicate that the variable is linearly associated with response time? Select all that apply.

o Income

o Distance

o Crimes

o Height

o None of the above.

ii. (2.0 pt) Kimiko suspects she may have made a mistake in her code when plotting the residuals. Which of the plots above are impossible residual plots?

Select all that apply.

o Income

o Distance

o Crimes

o Height

o None of the above.

iii. (2.0 pt) For which of the above plots should Kimiko try a quadratic equation for regression? Recall:  a quadratic equation is one of the form ax2 + bx + c .

Select all that apply.

o Income

o Distance

o Crimes

o Height

o None of the above.

4. (16.0 points) Spiderverse

Dr. Strange, a former neurosurgeon, is building a device to help him travel to parallel universes, each of which contains an alternate variant of our planet Earth (for example, in Earth-833, the CEO of Twitter is female entrepreneur Elona Musk).

There is a small percentage of these parallel Earths (exactly 1% ) that contains a superhero named Spiderman. Dr. Strange wants to nd a Spiderman, but he doesn’t have time to explore every Earth variant.

Suppose Dr. Strange knows that if an Earth variant has a Spiderman, 95% of the time it has a man named Peter Parker. If an Earth variant doesn’t have a Spiderman, it has a Peter Parker only 7% of the time.

(a) (3.0 pt) If Dr. Strange randomly selects an Earth variant to visit, what is the probability that it does not

have a Peter Parker?

○ 0.95 × 0.93

○ 0.01

○ 0.05

○ 0.93

○ 0.01 × 0.05 + 0.99 × 0.93

○ 0.01 × 0.93

○ 0.01 × 0.05

○ There is not enough information to answer.

(b) (3.0 pt) If Dr. Strange randomly selects an Earth variant to visit, what is the probability that it has a Spiderman and does not have a Peter Parker?

○ 0.95 × 0.93

○ 0.01

○ 0.05

○ 0.93

○ 0.01 × 0.05 + 0.99 × 0.93

○ 0.01 × 0.93

○ 0.01 × 0.05

○ There is not enough information to answer.

(c) (3.0 pt) Suppose Dr. Strange’s random selection leads him to visit the Zombie Earth variant, which is inhabited by zombies instead of humans.

Dr. Strange discovers that Zombie Earth does not have a Peter Parker in it.

Given this information, what is the probability that Zombie Earth has a Spiderman?

○ ○

0.05

0.01 × 0.95

0.01 × 0.95 + 0.99 × 0.07 0.99 × 0.95

0.99 × 0.95 + 0.01 × 0.07 0.01 × 0.05

0.01 × 0.05 + 0.99 × 0.93

0.93

(d) (3.0 pt) Suppose Dr. Strange’s random selection leads him to visit Earth-42, which he discovers has a girl named MJ.

Prior to inspecting all of Earth-42’s inhabitants, the information above makes Dr. Strange believe there is a 60% probability that it has a Spiderman.

Suppose that upon inspection, Dr. Strange learns that Earth-42 does not have a man named Peter Parker.

Given this new information, and assuming the conditional probabilities in the problem statement are still valid, what is Dr. Strange’s subjective probability that Earth-42 does not have a Spiderman?

○ ○ ○

0.4 × 0.93 + 0.6 × 0.05

0.4 × 0.93

0.4 × 0.93 + 0.6 × 0.05 0.6 × 0.05

0.6 × 0.05 + 0.4 × 0.93 0.4 × 0.95

0.4 × 0.95 + 0.6 × 0.07 0.6 × 0.95

0.4 × 0.95 + 0.6 × 0.07

(e) (4.0 pt) BayesRule can be used to do which of the following?

Select all that apply.

o Quantify subjective beliefs about uncertainty.

o Update probabilities based on new information.

o Calculate conditional probabilities.

o Determine, in multi-stage random experiments, the probability of an earlier stage outcome given the outcome of a later stage.

o None of the above.

5. (12.0 points) Data 8 Merch

Berkeley plans to randomly select two people without replacement on Data 8 course staff to each receive a Data 8 sweater. There are 2 professors, 30 tutors, and 50 TAs on staff.

Important: Assume that each individual stamember is equally likely to be selected.

(a) (3.0 pt) Suppose we know that one professor received a sweater and the other didn’t.   Given this information, what is the probability that no tutor gets a sweater?

× ×

○ There is not enough information to answer.

(b) (3.0 pt) What is the probability that only TAs receive sweaters?

×

×

×

2 ×

1 - ×

1 - ×

1 - ×

○ There is not enough information to answer.

(c) (3.0 pt) What is the probability that at least one professor receives a sweater?

1 - ×

×