Machine learning (7-Regularization)

1、The Problem of Over-fitting

  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)

2、Cost Function

  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)

3、Regularized Linear Regression

  • Machine learning (7-Regularization)
  • Machine learning (7-Regularization)

4、Regularized Logistic Regression

  • Machine learning (7-Regularization)
import numpy as np
def costReg(theta, X, y, learningRate):
 theta = np.matrix(theta)
 X = np.matrix(X)
 y = np.matrix(y)
 first = np.multiply(-y, np.log(sigmoid(X*theta.T)))
 second = np.multiply((1 - y), np.log(1 - sigmoid(X*theta.T)))
 reg = (learningRate / (2 * len(X))* np.sum(np.power(theta[:,1:the
ta.shape[1]],2))
 return np.sum(first - second) / (len(X)) + reg
上一篇:CosId 1.0.0 发布,通用、灵活、高性能的分布式 ID 生成器


下一篇:Linux磁盘,进程,软件安装(四)