Closed oooook0 closed 6 years ago
Hey Lasse,
The calc_w function in your SVM function seems wrong, it should return a vector but it ends up with a matrix. I rewrote the calc_w as follow, it worked, let me know what you think.
def calc_w(self, alpha, y, X): X_t = X.transpose() X_ta = np.matmul(X_t, X) X_tai = np.linalg.inv(X_ta) ols = np.matmul(X_tai, X_t) ols = np.matmul(ols, y) return ols
Hey Lasse,
The calc_w function in your SVM function seems wrong, it should return a vector but it ends up with a matrix. I rewrote the calc_w as follow, it worked, let me know what you think.