Fall 2021 Midterm APS1070
University of Toronto
Faculty of Applied Science and Engineering
Midterm – due Oct 19, 2021 at 21:00
Copyright By PowCoder代写 加微信 powcoder
APS1070 – Foundations of Data Analytics and Machine Learning
Examiner: Prof.
Please read the instructions and honour agreement below carefully.
Family Name(s): Given Name(s): Student Number:
Instructions to Candidate:
– This assessment paper has 6 pages (including this one) and 5 questions. – Duration: 2.5 hours available (1.5 hours required)
– Maximum mark is 20% of final grade
– Write answers for each question separately and upload to Crowdmark as a pdf or image file
– Show important steps leading to final answers – Late submissions will receive a grade of 0
– Read over and sign the honour agreement
In submitting this assessment, I confirm that my conduct during this take-home assessment adheres to the Code of Behaviour on Academic Matters. I confirm by signing below that I have not acted in such a way that would constitute cheating, misrepresentation, or unfairness, including but not limited to, using unauthorized aids and assistance, impersonating another person, and committing plagiarism. I pledge upon my honour that I have not violated the Faculty of Applied Science & Engineering’s during this assessment.
Question Mark
Engineering :
Page 1 of 6
Fall 2021 Midterm APS1070 QUESTION 1 [4 marks]:
This table shows the data collected about 100 customers who visited a store and made some purchases. Answer the following two questions based on the data.
Gender Male Male Female Female
Purchase ($) 10
Frequency 12
Part 1) Determine whether
Part 2) Quantify and interpret the strength of relationship between gender and purchase.
gender and purchase depend on each other or not.
Page 2 of 6
Fall 2021 Midterm APS1070 QUESTION 2 [4 marks]:
What is the asymptotic running time of an algorithm that grows logarithmically with 𝑛! for an input of size 𝑛? Justify your answer with a mathematical proof.
Page 3 of 6
Fall 2021 Midterm APS1070 QUESTION 3 [4 marks]:
The following plots represent evaluations of prediction error for a machine learning task based on a model with different levels of flexibility (complexity). Using the concept of bias-variance trade-off, indicate the suitable level of model flexibility for each of the three plots by adding an X on the suitable point on the horizontal axes. Justify your choices.
Page 4 of 6
Fall 2021 Midterm APS1070 QUESTION 4 [5 marks]:
Write a Python code to implement a nearest neighbour classifier without using loops or scikit-learn and other machine learning libraries. You can use numpy. You can write a pseudo-code for partial marks. The inputs are:
a) Training data XNxD : where N is the number of samples and D is the number of features.
b) Labels YNx1 : contains the corresponding integer label for each training example. (You may assume the
labels are integers from 1 to K.)
c) Query (test) vector Q1xD : you will return the predicted class for this vector. Hints: You might find these functions useful.
– numpy.sum(a, axis)
Returns the sum of array elements over a given axis.
– numpy.argmin(a, axis)
Returns the indices of the minimum values along an axis.
Page 5 of 6
Fall 2021 Midterm APS1070 QUESTION 5 [3 marks]:
What is the average running time of quicksort (as discussed in the lecture 2) on the following three arrays: A, B, C? Justify your answer for each array.
Part 1) Part 2) Part 3)
A = [a1, a2, …, an] , ai ≠ aj for all 1 ≤ i , j ≤ n B = [a1, a2, …, an] , a1< a2< ...< an
C = [a1, a2, ..., an] , a1> a2> …> an
Page 6 of 6
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com