代做MAT9004 Mathematical foundations for data science and AI Assignment 1帮做Python语言程序
- 首页 >> C/C++编程MAT9004 Mathematical foundations for data science and AI
Assignment 1
MAT9004 Assignment 1
Due: Wednesday, 26 March 2025, 23:55 PM (Week 4)
Please write up your solutions neatly! In particular, use notation and terminology correctly and include some necessary comments. Partial marks will be given for showing that you know some aspects of the answer, even if your solution is incomplete. The questions are NOT arranged in order of difficulty, so you should attempt every question.
Both handwritten and typed solutions are accepted. Please make sure you convert all your work into on single pdf file as other types might not display properly on moodle.
1. [10 points] A librarian at a university notices that the number of books in a particular section at the start of the academic year 2025 is 2,000, and that at the start of any subsequent week the number of books increases by 1.5% compared to what it was exactly one week earlier, due to new acquisitions and donations.
(a) [2 points] Find a function b : R → (0, ∞) such that b(t) models the number of books estimated by the librarian in that section after exactly t weeks. Here t ∈ R measures the number of weeks since the start of the academic year (e.g. t = 1/2, is halfway through the first week). Similarly, you should consider the population of books to be a gradually growing real number (ignoring the fact that it is actually restricted to be an integer).
(b) [2 points] Explain why the inverse function b-1 exists.
(c) [2 points] Calculate a formula for b-1 .
(d) [1 point] The function b can be described as taking the time (in weeks) starting from the beginning of academic year 2025 as input and outputting the number of books in that particular section in the library. Provide a similar description for what the function b-1 does.
(e) [2 points] Find b′ (t) and explain what b′ (t) measures by giving a description of the same type as in part (d).
(f) [1 point] What is the total number of books in that section of the library at the end of 2025, that is, after 52 weeks?
2. [6 points] Sketch a neat graph of a function with a domain [0 , 4] that clearly demonstrates the properties in each case, without the graph containing a straight line on any significant interval.
(a) [2 points] Function f(x) such that :
(i) f′ (x) > 0 on [0, 2) and (3, 4], f′ (x) < 0 on (2,3);
(ii) f′′ (x) ≤ 0 on (0, 1) but f′′ (x) ≥ 0 on (1, 2);
(iii) f(x) has a global minimum at x = 3 and a global maximum at x = 2.
(b) [2 points] Function g(x) such that :
(i) g′′ (x) ≥ 0 on [0, 1) and (3, 4]
(ii) g(x) has global maximum at x = 1, x = 3 and x = 4.
(c) [2 points] Function h(x) such that :
(i) h′ (2) = 0.
(ii) h′ (x) ≥ 0 for all x ∈ [0, 4].
(iii) h(x) does not have local minimum or local maximum.
3. [16 points] This question involves one of the simplest method of machine learning : least squares inter- polation (or minimization of RSS error). The RSS formula, which is what we want to minimise, is the function
where each pair (xi , yi ) correspond to one data point and n is the total number of points you have.
We will explore a simplified version of the three basic functions for data analysis discussed in the lecture (linear, power law and exponential).
(a) [4 points] Consider the linear function f(x) = mx + c, write down the RSS function. Assume that the constant term c is known, write a general formula of m for which the RSS error is minimized. For the rest of this question, consider the following data set:
(b) [2 points] First we consider the linear model f(x) = mx + 1. Use the above result or otherwise, find the value of m that minimize the RSS error. Hence write down the linear model and calculate the RSS error for this model.
(c) [4 points] Next, we consider the exponential model by taking a least square regression of loge y vs. x (make sure you use base e, otherwise the intercept will be different). Consider a least square regression with intercept 0.4, that is, ln y = mx + 0.4. Use similar procedure to find the value of m that minimize the RSS error. Hence write the model in the form g(x) = Bax and calculate the RSS error of the exponential model.
(d) [5 points] Now consider the power-law model. Repeat the above process with an appropriate data transformation mentioned in the lecture (again, make sure you use base e). The least square equation of the transformed data has an intercept of 0 .6. Find the least square linear equation and then write the power-law model in the form y = Axb. Also calculate the RSS error of this model.
(e) [1 point] Based on your previous parts, which of the above three model fits better and why?