You are viewing a single comment's thread. Return to all comments →
#python import numpy as np m, n=map(int, input().split()) Y, X, res=[], [], [] for _ in range(n): temp=list(map(float, input().split())) Y.append(temp[-1]) temp.pop() X.append([1.0] + temp) Xtranspose=np.transpose(X) coeffset=np.dot(np.dot(np.linalg.inv(np.dot(Xtranspose, X)), Xtranspose), Y) q=int(input()) for x in range(q): s=coeffset[0] temp=list(map(float, input().split())) for i in range(m): s+=temp[i]*coeffset[i+1] res.append(s) print(*res, sep='\n')
Seems like cookies are disabled on this browser, please enable them to open this website
Day 9: Multiple Linear Regression
You are viewing a single comment's thread. Return to all comments →