Re: Homework#6 Q3
Quote:

Re: Homework#6 Q3

Re: Homework#6 Q3
Quote:

Re: Homework#6 Q3

Re: Homework#6 Q3
Quote:

Re: Homework#6 Q3

Re: Homework#6 Q3
Quote:

Re: Homework#6 Q3
My answers for any value of K are order(s) of magnitude higher that the options.
w_reg = (Z^\top Z + λI)^1 Z^T y As a Python noob, perhaps someone can confirm that I need the linalg.inv of the first term in parentheses, because we cannot use the pinv method when the weight term is present. thanks. 
Re: Homework#6 Q3
Kekeli:
I don't know about Python, but in R I was using the "chol2inv" function of the "Matrix" library to find the matrix inverse. It turns out this wasn't the right tool for the job. I ended up using "solve" from the base package to find the inverse. So in R, I used the following functions: 
Re: Homework#6 Q3
Thank you for confirming the flow.
Turns out when transforming the test and training set vectors, I was leaving in the bias term, thus x1 and x2 were screwy before creating the polynomial. eep. 
Re: Homework#6 Q3
Kekeli, could you explain this? What do you mean by the bias term?
Thanks (I'm still trying to debug my own code.) 
Re: Homework#6 Q3
Michael, I'm sorry I didn't see this until now.
While testing the file IO, I had inserted 1.0 into the vector of input variables after reading the contents of "in.dta". Then, when doing the nonlinear transformation, I was reading x1 as 1.0, and x2 as x1. Not surprisingly, the linear regression with or without weight decay didn't return the correct estimates for Ein and Eout. In the end, print statements saved the day. I just wish I'd started in the transformation and not everywhere else in the code. 
Re: Homework#6 Q3
Great job :)
خلطة بياض الثلج 
All times are GMT 7. The time now is 12:32 PM. 
Powered by vBulletin® Version 3.8.3
Copyright ©2000  2021, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. AbuMostafa, Malik MagdonIsmail, and HsuanTien Lin, and participants in the Learning From Data MOOC by Yaser S. AbuMostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.