100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

SOLUTIONS MANUAL FOR A FIRST COURSE IN MACHINE LEARNING (2ND EDITION) EXERCISE & SOLUTIONS BY SIMON ROGERS AND MARK GIROLAMI

Rating
-
Sold
-
Pages
68
Grade
A+
Uploaded on
10-12-2024
Written in
2024/2025

SOLUTIONS MANUAL FOR A FIRST COURSE IN MACHINE LEARNING (2ND EDITION) EXERCISE & SOLUTIONS BY SIMON ROGERS AND MARK GIROLAMI

Institution
A FIRST COURSE IN MACHINE LEARNING
Module
A FIRST COURSE IN MACHINE LEARNING











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
A FIRST COURSE IN MACHINE LEARNING
Module
A FIRST COURSE IN MACHINE LEARNING

Document information

Uploaded on
December 10, 2024
Number of pages
68
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

SOLUTIONS MANUAL FOR A FIRST COURSE IN MACHINE LEARNING
(2ND EDITION) EXERCISE & SOLUTIONS BY SIMON ROGERS AND MARK
GIROLAMI

, Chapter 1


EXERCISE: 1.1. A high positive value of w 0 and a small negative value for w1.
These reflect the high intercept on the t axis (corresponding to the
theoretical time winning time at x = 0 and the small decrese in winning time
over the years.


EXERCISE: 1.2. The following would do the job:

1 % Attributes are stored in Nx1 vector x
2 % Targets are stored in Nx1 vector t
3 xb = mean(x);
4 tb = mean(t);
5 x2b = mean(x.*x);
6 xtb = mean(x.*t);
7 w1 = (xtb − xt*xb)/(x2b−xbˆ2);
8 w0 = tb−w1*xb;
9 % Plot the data
10 plot(x,t,'b.','markersize',25);
11 % Plot the model
12 hold on;
13 plot(x,w0+w1*x,'r','linewidth',2);




EXERCISE: 1.3. We need to find wTXTXw. We’ll start with XTX. Multiplying XT by X gives:

ΣN ΣN
T n=1x2n1 n=1 x n1x n2
X X= ΣN xn2 xn1 ΣN 2
n=1 n=1 xn2



Multiplying this by w gives:
Σ ΣN
T w0 N 2
+ w1 xn1xn2
x n1
w0 Σn=1
N
n=1 x n2 x n1 +
w1
n=1
Σ
X Xw = N
x
2
n=1 n2

1

, 2 CHAPTER 1.

Finally, pre-multiplying this by wT gives:
N
Σ Σ
N
wTXTXw = w0 x2n1 + w1 xn1xn2 +
w0 n=1 n =1
Σ
N
Σ
N
2
w1 w0 xn2xn1 + w1 xn2
n =1 n=1
Σ
N Σ
N Σ
N
= w2 x2 + 2w 0w 1 xn1x n2 + w 2 x2
0 n1 1 n2
n=1 n=1 n=1

as required.
EXERCISE: 1.4. Let’s first
work out Xw:
w 0x11 + w 1x12
w 0x21 + w 1x22
Xw =
.
w 0x N 1 + w 1x N 2
Therefore
(Xw)T = [w0x11 + w1x 12, w0x 21 + w1x22, . . . , w0xN1 + w1x N2]
Finally, work out wTXT:
wTXT = [w0x11 + w1x 12, w0x21 + w1x 22, . . . , w0xN1 + w1x N2]
as required.
Σ
EXERCISE: 1.5. Starting with n xnt n. The result of this is a column vector of the same size as x
(2 × 1). Now, using the definition of X,
x11, x21, . . . , xN1
XT =
x12, x22, . . . , xN2
(which is a 2× N vector). Multiplying this by t gives a×2 1 vector that looks
like this: Σ N xn1tn
T n=1
X t = ΣN
n=1 x n2tn
Σ
which is n xnt n as required. The second EXERCISE:ample, XTXw. We already know what
T
X Xw is (EXERCISE:ercise 1.3)
Σ ΣN
T w0 N 2
+ w1 xn1xn2
x
w0 Σn=1
N
n1
n=1 x n2 x n1 +
Σ
n=1
w1 x
X Xw = N 2
n=1 n2
Now, xnxnT is the following matrix:

xnxT = x2n1 xn1xn2
2
n xn2xn1 xn2

, 3

Multiplying this by w gives:

T w0x2n1 + w1xn1xn2
xnxnw = 2
w0xn2xn1 + w1xn2
Summing over the N terms leads us to the matrix we derived previously.
EXERCISE: 1.6. Code below:

1 %% Women's 100m data
2 % Load all Olympic data
3 load olympics;
4 % Copy the necessary variables
5 x = female100(:,1); % Olympic year
6 t = female100(:,2); % Winning time
7 % Augment x
8 X = [repmat(1,size(x)) x];
9 % Get solution
10 w = inv(X'*X)*X'*t;

The fitted model
is: t = 40.9242 − 0.0151x

EXERCISE: 1.7. Plugging 2012 and 2016 into the above EXERCISE:pression
yields winning times of 10.5997 and 10.5394 respectively.
EXERCISE: 1.8. The men’s model is:
t = 36.4165 − 0.0133x
The women’s model
is: t = 40.9242 − 0.0151x
The women’s time is decreasing faster than the men’s. Therefore, the
women will be faster at the first Olympics after the x that gives identical
winning times:
40.9242 − 0.0151x = 36.4165 − 0.0133x
x = 2589

The nEXERCISE:t Olympic year after 2589 is (assuming they continue to be
held every four years) is the year 2592. The winning times are the
unrealistically fast 1.8580 seconds and 1.8628 seconds for women and men
respectively.
EXERCISE: 1.9. Code below (synthdata cv.m):

1 clear all;close all;
2 load synthdata
3
4 % Augment x
5 X = repmat(1,size(x));
6 for k = 1:4
7 X = [X x.ˆk];
8 end
9

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
PurityKauri Johns Hopkins University
Follow You need to be logged in order to follow users or courses
Sold
920
Member since
2 year
Number of followers
388
Documents
3831
Last sold
1 week ago
GET FINEST EXAM MATERIALS ON THIS PAGE.OFFERING TUTORING ASSISTANCE ,ALL KIND OF QUIZ,STUDY GUIDES, EXAMS AND RETAKE PAPERS WITH GUARANTEE OF A PASS

Welcome to my store! In need to elevate your academic grades? search no more. Here you'll find thousands of comprehensive 5-star rated resources that will help you in your revision to enhance your grades. I'm dedicated to offering you with top-quality, accurate , reliable and latest update documents with 100% pass guarantee. The resources are expert verified and many students have already benefited from them. I welcome you to explore my store to unlock all the materials you need to enhance your success with ease.

Read more Read less
4.1

173 reviews

5
107
4
19
3
20
2
8
1
19

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions