(SOLVED) [Python] Data Science Project - OLS Method
So, I didn't quite understand the task of the Coding Project in the module about the Machine Learning of Data Science course. Could someone please clarify the task and give a few hints? I don't ask for the code. I just need a normal explanation in plain English π₯²
5/24/2022 2:11:50 PM
πΊπ¦ GUMBALL πΊπ¦
8 Answers
New AnswerOkay, I think I remember the task β the issue form me was: There is no image showing the formula. However, I solved it like this: https://code.sololearn.com/W6GU7ALMWfZY/?ref=app
Lisa, I'm sorry, but I still can't do it! π ππ Here's my attempt: https://code.sololearn.com/cujmIqI51NP6/?ref=app Am I missing the most obvious thing ever? It gives ALMOST what I need in the first test and then throws an exception (for obvious reasons, though I don't know how I could fix it) on the second one
Lisa First test: Input: 2 2 1 0 0 2 Output: [[2. 0. ] [0. 1.5]] Should be: [2. 1.5] That's close tho. Second test: Input: 3 2 1 2 1 0.5 1 0.3 3 3.5 3.2 Output: Exception: operands could not be broadcasted....... (Something because shapes are different) And shapes of two operands are (3,4) and (4,3). So that's a transposed and a normal matrix. And how can we multiply matrices with different shapes? Also, what is wrong with the first test?
Lisa that helped! But it didn't solve the problem. Anyways, I was searching through NumPy docs and found the np.matmul function. Don't know what it does, but after playing around with code I solved the problem! Thanks for helping!
You tried to use * for multiplying the matrice/ vectors. Rather use dot product, np.dot(a, b)