Skip to content

Commit

Permalink
乐高玩具二手价格预测
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Cherish committed Dec 10, 2017
1 parent 44eda2a commit d465aa2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Regression/lego.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def ridgeRegres(xMat, yMat, lam = 0.2):
xTx = xMat.T * xMat
denom = xTx + np.eye(np.shape(xMat)[1]) * lam
if np.linalg.det(denom) == 0.0:
print("矩阵为奇异矩阵,不能转置")
print("矩阵为奇异矩阵,不能求逆")
return
ws = denom.I * (xMat.T * yMat)
return ws
Expand Down Expand Up @@ -159,7 +159,7 @@ def standRegres(xArr,yArr):
xMat = np.mat(xArr); yMat = np.mat(yArr).T
xTx = xMat.T * xMat #根据文中推导的公示计算回归系数
if np.linalg.det(xTx) == 0.0:
print("矩阵为奇异矩阵,不能转置")
print("矩阵为奇异矩阵,不能求逆")
return
ws = xTx.I * (xMat.T*yMat)
return ws
Expand Down

0 comments on commit d465aa2

Please sign in to comment.