赞
踩
y ^ = h Θ ( x ) = Θ ∗ x 其中 Θ 是模型的参数向量,其中包括偏置项 Θ 0 和特征权重 Θ 1 至 Θ n x 是实例的特征向量,包括从 x 0 至 x n , x 0 始终为 0 Θ ∗ x 是向量 Θ 与 x 点积 h Θ 是假设函数,使用模型参数 Θ \widehat{y} = h_{\Theta}(x) = \Theta*x \\其中\Theta是模型的参数向量,其中包括偏置项\Theta_0和特征权重\Theta_1至\Theta_n \\x是实例的特征向量,包括从x_0至x_n,x_0始终为0 \\ \Theta*x是向量\Theta与x点积 \\h_{\Theta}是假设函数,使用模型参数\Theta y =hΘ(x)=Θ∗x其中Θ是模型的参数向量,其中包括偏置项Θ0和特征权重Θ1至Θnx是实例的特征向量,包括从x0至xn,x0始终为0Θ∗x是向量Θ与x点积hΘ是假设函数,使用模型参数Θ
M S E = ( X , h Θ ) = 1 / m ∑ i = 1 m ( Θ T x ( i ) − y ( I ) ) 2 MSE = (X,h_{\Theta}) = 1/m\sum_{i = 1}^{m}(\Theta^Tx^{(i)}-y^{(I)})^2 MSE=(X,hΘ)=1/mi=1∑m(ΘTx(i)−y(I))2
Θ ^ = ( X T X ) − 1 X T y 方程中 Θ ^ 是使成本函数最小的 Θ 值 y 是包括 y ( 1 ) 到 y ( m ) 的目标值向量 \widehat{\Theta}=(X^TX)^{-1}X^Ty \\方程中\widehat{\Theta}是使成本函数最小的\Theta值 \\y是包括y^{(1)}到y^{(m)}的目标值向量 Θ =(XTX)−1XTy方程中Θ 是使成本函数最小的Θ值y是包括y(1)到y(m)的目标值向量
$$
成本函数的偏导数:
\ \frac{ \partial MSE(\theta)}{\partial\theta_j} = 2/m\sum_{i = 1}{m}(\ThetaTx{(i)-y{i}})x_{j}^{(i)}
$$
梯度向量: ∇ Θ M S E ( Θ ) = 2 / m X T ( X Θ − y ) 梯度向量: \nabla_{\Theta}MSE(\Theta) = 2/mX^T(X\Theta-y) 梯度向量:∇ΘMSE(Θ)=2/mXT(XΘ−y)
梯度下降步骤: Θ 下一步 = Θ − η ∇ Θ M S E ( Θ ) ( η 为学习率 ) 梯度下降步骤:\Theta^{下一步} = \Theta-\eta\nabla_{\Theta}MSE(\Theta)\ \ \ \ \ (\eta为学习率) 梯度下降步骤:Θ下一步=Θ−η∇ΘMSE(Θ) (η为学习率)
eta = 0.1
n_iteration = 1000#迭代次数
m = 100
theta = np.random.randn(2,1)
for n in range(n_iteration):
gradienters = 2/m*x_b.T.dot(x_b.dot(theta)-y)#偏导计算
theta = theta-eta*gradienters #更改theta
'''随机梯度下降''' n_epochs = 50#向前或向后迭代次数 t0,t1 = 5,50 #学习步长超参数 def learning_schedule(t):#计算步长 return t0/(t+t1)#步长逐渐减小 theta = np.random.randn(2,1) for n in range(n_epochs): for i in range(m): random_index = np.random.randint(m) xi = x_b[random_index:random_index+1] yi = y[random_index:random_index+1] gradienters = 2*xi.T.dot(xi.dot(theta)-yi) eta = learning_schedule(n*m+i) theta = theta-eta*gradienters
sgd_reg = SGDRegressor(max_iter=1000,tol = 1e-3,penalty=None,eta0=0.1)
sgd_reg.fit(x,y.ravel())
print(sgd_reg.intercept_,sgd_reg.coef_)
'''小批量梯度下降''' theta_path_mgd = [] n_iterations = 50 minibatch_size = 20 np.random.seed(42) theta = np.random.randn(2,1) # random initialization t0, t1 = 200, 1000 def learning_schedule(t): return t0 / (t + t1) t = 0 for epoch in range(n_iterations): shuffled_indices = np.random.permutation(m) x_b_shuffled = x_b[shuffled_indices] y_shuffled = y[shuffled_indices] for i in range(0, m, minibatch_size): t += 1 xi = x_b_shuffled[i:i+minibatch_size] yi = y_shuffled[i:i+minibatch_size] gradients = 2/minibatch_size * xi.T.dot(xi.dot(theta) - yi) eta = learning_schedule(t) theta = theta - eta * gradients theta_path_mgd.append(theta)
'''多项式回归''' m = 100 x = 6*np.random.rand(m,1)-3 y = 0.5*x**2+x+2+np.random.randn(m,1) poly_features = PolynomialFeatures(degree=2,include_bias=False)#聚类特征 x_poly = poly_features.fit_transform(x) lin_reg = LinearRegression() lin_reg.fit(x_poly,y) #画图 X_new=np.linspace(-3, 3, 100).reshape(100, 1) X_new_poly = poly_features.transform(X_new) y_new = lin_reg.predict(X_new_poly) plt.plot(x, y, "b.") plt.plot(X_new, y_new, "r-", linewidth=2, label="Predictions") plt.xlabel("$x_1$", fontsize=18) plt.ylabel("$y$", rotation=0, fontsize=18) plt.legend(loc="upper left", fontsize=14) plt.axis([-3, 3, 0, 10]) plt.show()
PolynomialFeatures还可以将特征的所有组合添加到给定的多项式阶数
成本函数
J
(
Θ
)
=
M
S
E
(
Θ
)
+
α
1
2
∑
i
=
1
n
Θ
i
2
超参数
α
控制要对模型进行正规化的程度。如果
α
=
0
,则岭回归仅是线性回归。
如果
α
非常大,则所有权重最终都非常接近于零,结果是一条经过数据均值的平线
J(\Theta) = MSE(\Theta)+\alpha\frac{1}{2}\sum_{i=1}^{n}\Theta_i^2 \\超参数\alpha控制要对模型进行正规化的程度。如果\alpha=0,则岭回归仅是线性回归。 \\如果\alpha非常大,则所有权重最终都非常接近于零,结果是一条经过数据均值的平线
J(Θ)=MSE(Θ)+α21i=1∑nΘi2超参数α控制要对模型进行正规化的程度。如果α=0,则岭回归仅是线性回归。如果α非常大,则所有权重最终都非常接近于零,结果是一条经过数据均值的平线
闭式解的岭回归:
Θ
^
=
(
X
T
X
+
α
A
)
−
1
X
T
y
\widehat{\Theta} = (X^TX+\alpha A)^{-1}X^Ty
Θ
=(XTX+αA)−1XTy
from sklearn.linear_model import Ridge
np.random.seed(42)
m = 20
X = 3 * np.random.rand(m, 1)
y = 1 + 0.5 * X + np.random.randn(m, 1) / 1.5
X_new = np.linspace(0, 3, 100).reshape(100, 1)
ridge_reg = Ridge(alpha=1, solver="cholesky", random_state=42)
ridge_reg.fit(X, y)
ridge_reg.predict([[1.5]])
ridge_reg = Ridge(alpha=1, solver="sag", random_state=42)
ridge_reg.fit(X, y)
ridge_reg.predict([[1.5]])
最小绝对收敛和选择算子回归(Least Absolute Shrinkage and Selection Operator Regression)
成本函数:
J
(
Θ
)
=
M
S
E
(
Θ
)
+
α
∑
i
=
1
n
∣
Θ
i
∣
J(\Theta) = MSE(\Theta)+\alpha\sum_{i=1}^{n}|\Theta_i|
J(Θ)=MSE(Θ)+αi=1∑n∣Θi∣
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jufNfNa1-1658889211621)(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj4AAAEYCAYAAABcL/waAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAABUKklEQVR4nO3dd3hUVfrA8e9JgRQIkABBSghVepBEKaIGISKsiOu69oKrlLVXLKhgxYK4a0HlJwoqCurqYqEIaBQkIEFJKIIrHSQhQAgQAkkm5/fHSSWTOnf6+3meeZLcuXPvO5PJm3fOPUVprRFCCCGE8AcB7g5ACCGEEMJVpPARQgghhN+QwkcIIYQQfkMKHyGEEEL4DSl8hBBCCOE3pPARQgghhN+QwkcIIYQQfsMphY9SqotS6qRS6sNq9rlXKZWhlMpRSr2rlGrojFiEEL5B8ooQwgrOavF5A1hb1Z1KqeHAw8BQIBboCDzppFiEEL5B8ooQwmGWFz5KqauBI8Dyana7CZiltd6ktc4GngbGWB2LEMI3SF4RQlglyMqDKaUigKcwn7huqWbXnsCCcj+nAdFKqSit9SE7xx0HjAMIDw+P79atm3VBCyGcat26dQe11i3q+3hn5BXJKUJ4L0dziqWFD+YT1iyt9R6lVHX7NQJyyv1c8n1joFLho7WeCcwESEhI0KmpqdZEK4RwOqXULgcPYXlekZwihPdyNKdYVvgopfoCw4CzarH7cSCi3M8l3x+zKh4hhPeTvCKEsJqVLT6JmA6Fu4s/lTUCApVSPbTW/U7bdxMQB3xS/HMckGnvMpcQwq8lInlFCGEhKzs3zwQ6AX2Lb28B3wDD7ez7PnCLUqqHUqoZ8Bgw28JYhBC+QfKKEM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gi/IYWPEEIIIfyGFD5CCCGE8BtS+AghhBDCb0jhI4QQQgi/IYWPEEIIIfyGFD7CJZRSoUqpvUqp3Uqphqfd945SyqaUutpd8QkhvI/kFVEfUvgIl9Ba5wGTgXbAbSXblVJTgVuAO7XW89wUnhDCC0leEfUha3UJl1FKBQJpmNV3OwK3Aq9gVvp9yp2xCSG8k+QVUVdS+AiXUkpdAnwFLAcuBF7XWt/l3qiEEN5M8oqoC7nUJVxKa/018AswFJgP3H36Pkqp25VSPyulTiqlkl0cohDCy0heEXUR5O4AhH9RSl0J9C3+8Zi23+S4H3geOBsY6KLQhBBeSvKKqAspfITLKKUuAj4AvgAKgH8opV7RWv9Wfj+t9efF+8e4PkohhDeRvCLqSi51CZdQSvUHPgd+Aq4DHgOKgKnujEsI4b0kr4j6kMJHOJ1SqjvwDfA7cJnW+pTWehswCxitlDrXrQEKIbyO5BVRX1L4CKcqblb+FsgBRmitj5a7+ykgD3jRHbEJIbyT5BXhCOnjI5xKa70bM7mYvfv2A2GujUgI4e0krwhHSOEjPI5SKgjz3gwCApRSIUCR1jrfvZEJIbyV5BVRQgof4Ykew0xDXyIP+AFIdEs0QghfIHlFADJzsxBCCCH8iHRuFkIIIYTfkMJHCCGEEH5DCh8hhBBC+A0pfIQQQgjhN6TwEUIIIYTfkMJHCCGEEH5DCh8hhBBC+I3/B4kXc6vvVxn0AAAAAElFTkSuQmCC)]
Lasso回归子梯度向量:
$$
g(\Theta,J) = \nabla_{\Theta}MSE(\Theta)+\alpha\left|
\begin{matrix}
sin(\Theta_1)\
sin(\Theta_2)\
\vdots\
sin(\Theta_n)
\end{matrix}
\right|\ \ \ 其中sign(\Theta_i) =
\begin{cases}
-1\ 如果\Theta_i<0\
0\ 如果\Theta_i = 0\
+1\ 如果\Theta_i>0
\end{cases}
$$
from sklearn.linear_model import Lasso
lasso_reg = Lasso(alpha=0.1)
lasso_reg.fit(X, y)
lasso_reg.predict([[1.5]])
from sklearn.linear_model import ElasticNet
elastic_net = ElasticNet(alpha=0.1, l1_ratio=0.5, random_state=42)
elastic_net.fit(X, y)
elastic_net.predict([[1.5]])
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GFuvg0wm-1658889211622)(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAABEYElEQVR4nO3dd3hUVfrA8e+bBEIJoYZA6ApSBQSsKCCgKAgWFAurgCIqYMdeALGsruju/tZVRBAUV7EAKq6yiIAiNQhBKaJI7016SXl/f5yZzEyYhASSmUnyfp7nPHPvuWfmnrmEvDnnnnuOqCrGGGNMpIkKdwWMMcaYYCxAGWOMiUgWoIwxxkQkC1DGGGMikgUoY4wxESkm3BXIT1WqVNG6deuGuxrGGGPyYPHixbtUNSFrfpEKUHXr1iU5OTnc1TDGGJMHIrI+WL518RljjIlIFqCMMcZEJAtQxhhjIpIFKGOMMRHJApQxxpiIVKRG8Rlj8l9GRgabNm3i0KFD4a6KKYRKlChB1apViY+Pz/N7LUAZY3K0a9cuRISGDRsSFWWdLib3VJUjR46wefNmgDwHKftp83jtNbj2WmjcGFasCHdtjIkcf/75J4mJiRacTJ6JCGXKlKFGjRrs2LEjz++3FpTH9OnwzTdue8UKaNIkvPUxJlKkp6dTokSJcFfDFGKlS5cmNTU1z++zP4k8Gjf2ba9cGb56GBOJRCTcVTCF2Kn+/FiA8rAAZYwxkcUClEejRr7tVavCVw9jjDGOBSgP/xbUqlWQkRG+uhhjwm/YsGE0a9Ys2/1gBg8eTIcOHfL93MWVBSiPKlVcAjhyBDZsCG99jDGnpnv37nTu3DnosZUrVyIiTJ8+Pc+fO2TIEGbPnn261Quwbt06ROSEVRgK4lwFoUOHDgwePLjAPt8ClJ+srShjTOHTv39/vvvuO9atW3fCsTFjxlCnTh06deqU58+Ni4ujcuXK+VDDyDpXJLMA5cf/PpQNlDCmcOrWrRuJiYm8++67Afmpqam8//773H777agqd9xxB/Xq1aN06dI0aNCAV155hYwc+vazdrulp6czZMgQKlasSMWKFXnggQdIT08PeM8333zDJZdcQsWKFalUqRJdunRhpd8vl3r16gFw7rnnIiKZ3YNZz5WRkcGIESOoVasWsbGxnH322Xz++eeZx70tsc8++4zLLruMMmXK0KRJk5O2FL///nsuuOAC4uLiKF++POeffz6//PJL5vG5c+fSvn37zGeZ7rnnHvbv3w9A3759mT17Nm+88QYigogE/aPgdFiA8mMj+Yw5OZHwpdyIiYmhT58+jBs3LiDgfPnll+zatYt+/fqRkZFBjRo1+Pjjj1m5ciUvvPACL7744glBLScjR45k9OjRjBo1innz5pGens4HH3wQUObQoUM88MADLFy4kFmzZlG+fHm6d+/O8ePHAVi4cCHgAtnWrVuZNGlS0HP94x//4G9/+xsvv/wyP//8M9deey3XXXcdS5cuDSj31FNPcd9995GSksK5557LTTfdxMGDB4N+ZlpaGldffTUXX3wxKSkpLFiwgPvvv5/o6GgAfv75Zy6//HJ69OhBSkoKkyZNYunSpdx+++2Zdbrwwgvp168fW7duZevWrdSqVSvX1y9XVLXIpNatW+vp+PprVXDpkktO66OMKTJWrFgRsO/9PxKOlFurV69WQKdNm5aZ17VrV73iiiuyfc9jjz2mnTp1ytwfOnSoNm3aNNv96tWr6/PPP5+5n56erg0aNND27dtne46DBw9qVFSU/vDDD6qqunbtWgV00aJFAeWynispKUmHDx8eUKZ9+/bau3fvgM956623Mo9v2rRJgcxzZbV7924FdNasWUGP33rrrXr77bcH5C1ZskQB3b59e2YdBg0alO339Zf158gfkKxBfqdbC8qPdfEZUzQ0aNCAdu3aMXbsWAC2bNnCtGnT6N+/f2aZt956izZt2pCQkEBcXByvv/46G3I5Omrfvn1s3bqVCy+8MDMvKiqK888/P6DcmjVruOWWWzjzzDOJj48nMTGRjIyMXJ8HYP/+/WzZsoW2bdsG5F988cWsyDIvW/PmzTO3k5KSALKdYqhSpUr07duXLl260K1bN1577TU2btyYeXzx4sVMmDCBuLi4zOStw5o1a3Jd/9NhAcpP7dpQpozb3rXLJWNMoHC2ofKif//+TJkyhT179jBu3DgqVapEjx49AJg4cSIPPPAAffv2Zdq0aSxdupSBAwdmdr3ll+7du7Nz505GjRrFggULWLJkCTExMad0nmCzMWTN85+Synssp/tq7777LgsWLKBdu3Z88cUXnHXWWUybNi3zff3792fp0qWZKSUlhd9++42WLVvmuf6nwgKUn6goaNjQt2+tKGMKr+uvv55SpUoxYcIExo4dy2233Zb5C3zOnDmcf/75DB48mFatWlG/fv08tQrKly9P9erVmT9/fmaeqmbeUwLYvXs3K1eu5Mknn6Rz5840btyYAwcOkJaWllmmZMmSACcMrvAXHx9PUlISc+bMCcifM2cOTfJh0tAWLVrw2GOPMWvWLDp06MD48eMBaNWqFcuXL6d+/fonpNKlS2fWP6e6ny4LUFnYjBLGFA2lS5fmlltuYdiwYaxZs4Y77rgj89hZZ53FTz/9xNdff81vv/3GiBEj8vzc0f33388rr7zCp59+yq+//soDDzzA1q1bM49XrFiRKlWqMHr0aH7//Xdmz57N3XffTUyMb47uqlWrUrp0aaZNm8b27dvZt29f0HM98sgjvPrqq3z44YesXr2aZ599lh9++IGHH344j1fFZ+3atTz++OPMnTuX9evXM3PmTJYtW5YZ9B577DEWLlzI3XffzZIlS/j999+ZOnUqd911V+Zn1K1bl4ULF7Ju3Tp27dqVY2vtVFiAysJG8hlTdPTv35+9e/dy0UUX0djvP/ddd91Fr169uOWWWzj33HNZt25dnn/ZP/zww/Tr14/+/ftz/vnnk5GRQe/evTOPR0VFMXHiRJYtW0azZs0YNGgQI0aMIDY2NrNMTEwM//znP3nnnXdISkri6quvDnqu++67j0ceeYRHH32UZs2aMXnyZD777LPT6morU6YMq1ev5oYbbuCss86iT58+9O7dm8ceewxw97O+//571q1bR/v27WnRogVPPPEEiYmJmZ8xZMgQSpYsSZMmTUhISMjTvbXcEM1rx24Ea9OmjWZ9I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64cLVq0YObMmZnHV6xYQbdu3ShXrhxVq1bl5ptvZtu2bQAMGzaM8ePH89VXX2W2MmfNmpXXy14gwn0PKrK08Uymm5xM+fJwxhluNy3NnocyJoBI9untt33l3n4757L+WrfOXbl88MQTTzBw4EBWrFjBNddcw9GjR2nVqhVTp05l+fLl3H///dx1113MmDEjx8/54IMPiImJYe7cufzrX//i73//OxMnTszxPa+//jpnn302P/30E4899hiPPvoo8+bNA9wqttdeey0xMTHMnz+fcePGMXz4cI6d5C/kW265herVq7Nw4UKWLFnCsGHDKFWqFOBalO3ataNZs2YsXLiQb7/9loMHD9KjRw8yMjIYMmQIvXr1onPnzmzdupWtW7dy0UUX5eFqFpxQdvFFPr8WFLiBEn/84bKWLAkcOGGMKbzuvfderr8+cGDwI4/4nmQZMGAA3333HR9++CGdOnXK9nOaNGnCc889B7hFEEePHs2MGTO4+eabs33P5Zdfntmquvfee/nnP//JjBkzuPDCC5k+fTq//vor//vf/6hRowbgAlrbtm1z/D7r169nyJAhNPJMg1O/fv3MY2+++SYtWrTg5Zdfzsx77733qFSpEsnJyZx33nmULl2a2NhYqlWrluN5Qs1aUP68AWrJEkhLs4ESxmRHNfs0YICv3IABOZf1t3hx7srlgzZtApceSk9P54UXXqB58+ZUrlyZuLg4Jk2adNIF+Jo3bx6wn5SUxI4dO075PatWrSIpKSkzOAGce+65REXl/Kv6oYceon///nTs2JEXXniBVX6TiC5evJjvv/+euLi4zFSrVi2APC1zHw4WoPxVrgz16sGRI7BqFa1a+Q4tWhS+ahlj8lfZsmUD9l999VVGjhzJI488wowZM1i6dCnXXHMNx48fz/Fzsg6uEJGTLnue03tUFTmFLs1hw4ZldlfOnTuX5s2bM3bsWMB1G3br1o2lS5cGpN9++y0iR+75sy6+rEaOhLg4qFeP86r7spcscQMl/FZrNsYUEXPmzKF79+7ceuutgAsUq1evzhxkESqNGzdm8+bNbNmyhaSkJACSk5NPGvQAGjRoQIMGDbjvvvu45557eOedd7j99ttp1aoVH3/8MXXq1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AdflXrSKiXz/3Onr0CYdE4IUXfPvjx8Pq1SGqVzHTsmVLLrjgAtq2bcttt93Gm2++yebNm5k7d264q2aMyUFuA9QzQAPgd+AF4FFVPeR3/FZgRj7XrfD7y1+gVi045xw3ZC+L9u2hc2e3nZ4Ow4eHuH7FVHx8PACpqYFTQaakpNCjRw8qVqxI6dKladu2LT/88ENAmUWLFnHZZZdRuXJlypQpwxlnnMHAgQMB1/U13POPWKJEicyuxZyICE8//TQjR46kTp06lC1blm7durFjxw527NhBr169KF++PLVq1eLll18+4f0LFy6kc+fOxMXFUbZsWTp16sTCIANz/vGPf1C3bl1KlSpFmzZtTvheXmvXrqV3794kJCQQGxtLy5YtmTx5co7fwZgCo6q5SrjpjVoASUGOtQAq5/azCiq1bt1aI056eo6H581TdWPRVUVUf/45RPUqBt59910FdNWqVZqamqpHjx7VFStWaKdOnbRq1aq6b9++zLKLFy/WMmXKaNu2bfWTTz7Rr776Srt3764lS5bU5ORkVVU9cOCAVqxYUbt06aJffPGFzpw5U99991298847VVV148aNescddyigc+bM0Xnz5um8efNyrCOgtWvX1q5du+rUqVN1zJgxWq5cOe3SpYtedNFFOmLECJ0+fboOGDBAAf3qq68y35uSkqKlSpXSVq1a6SeffKKffvqptmnTRkuVKqVLly7NLPfOO+8ooH379tWvv/5a/+///k9r1Kih8fHx2qdPn8xyGzZs0ISEBG3atKm+//77+s0332i/fv1URPTzzz/PLDd06FB1vzqMyR9AsgaLO8EyC2uKyACVC1dd5QtS3buHuzZFhzdAZU1JSUm6cOHCgLIdO3bURo0a6bFjxzLz0tLStFGjRnr11VerquqiRYsU0JSUlGzP6f3lnZqamqs6AtqgQYOA8g8++KACOmLEiMy81NRUTUhI0L59+2bm9ezZU8uXL6979+7NzNu3b59WrFhRr732WlVVTU9P15o1a2qXLl0CzvvRRx8pEBCgbr/9dq1SpYru2rUroGznzp21RYsWJ3xHY/JLdgEqtw/qPpSblD9tuiJo/354803473+DHh4xwt2TAreU1MyZQYuZUzR58mQWLV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cbNp11TVA57jHYCZQANV/V1ENuEmM308mzoo8FdVfcKzH4ObDHaAqk7Iv29rTMGwe1DGFJzvgQFZ8v70256X5dg8oJtnuzGwzBucPOYCGUATEdmPW85gxknqsMy7oappIrITt7yGMRHPApQxBeewqv5+iu8V3FIgwXgXjsuN1Cz7inXtm0LCflCNCZ8Lguyv9GyvAFqISDm/4xfh/s+uVNXtwGagU4HX0pgwsRaUMQUnVkSqZclLV9Wdnu3rRGQRbsG363HB5nzPsQ9wgyjeE5FngYq4ARGT/FplLwCvi8h24CvcirCdVHVkQX0hY0LJApQxBaczsDVL3magpmd7GG7Z7H8CO4F+qroIQFUPi0gX4O/AQtxgi8+B+70fpKpvishx4GHcstt7gP8W0HcxJuRsFJ8xYeAZYXeDqn4a7roYE6nsHpQxxpiIZAHKGGNMRLIuPmOMMRHJWlDGGGMikgUoY4wxEckClDHGmIhkAcoYY0xEsgBljDEmIv0/+yhYT8ErZVIAAAAASUVORK5CYII=)]
np.random.seed(42) m = 100 x = 6 * np.random.rand(m, 1) - 3 y = 2 + x + 0.5 * x**2 + np.random.randn(m, 1) x_train, x_val, y_train, y_val = train_test_split(x[:50], y[:50].ravel(), test_size=0.5, random_state=10) poly_scaler = Pipeline([('poly_features',PolynomialFeatures(degree=90,include_bias=False)),('std_scaler',StandardScaler())]) x_train_poly_scaled = poly_scaler.fit_transform(x_train) x_val_poly_scaled = poly_scaler.transform(x_val) sgd_reg = SGDRegressor(max_iter=1,tol=-np.infty,warm_start=True,penalty=None,learning_rate='constant',eta0=0.0005) minimum_val_error = float('inf') best_epoch = None best_model = None for epoch in range(1000): sgd_reg.fit(x_train_poly_scaled,y_train) y_val_predict = sgd_reg.predict(x_val_poly_scaled) val_error = mean_squared_error(y_val, y_val_predict) if val_error < minimum_val_error: minimum_val_error = val_error best_epoch = epoch best_model = deepcopy(sgd_reg) #画图 sgd_reg = SGDRegressor(max_iter=1, tol=-np.infty, warm_start=True, penalty=None, learning_rate="constant", eta0=0.0005, random_state=42) n_epochs = 500 train_errors, val_errors = [], [] for epoch in range(n_epochs): sgd_reg.fit(x_train_poly_scaled, y_train) y_train_predict = sgd_reg.predict(x_train_poly_scaled) y_val_predict = sgd_reg.predict(x_val_poly_scaled) train_errors.append(mean_squared_error(y_train, y_train_predict)) val_errors.append(mean_squared_error(y_val, y_val_predict)) best_epoch = np.argmin(val_errors) best_val_rmse = np.sqrt(val_errors[best_epoch]) plt.annotate('Best model', xy=(best_epoch, best_val_rmse), xytext=(best_epoch, best_val_rmse + 1), ha="center", arrowprops=dict(facecolor='black', shrink=0.05), fontsize=16, ) best_val_rmse -= 0.03 # just to make the graph look better plt.plot([0, n_epochs], [best_val_rmse, best_val_rmse], "k:", linewidth=2) plt.plot(np.sqrt(val_errors), "b-", linewidth=3, label="Validation set") plt.plot(np.sqrt(train_errors), "r--", linewidth=2, label="Training set") plt.legend(loc="upper right", fontsize=14) plt.xlabel("Epoch", fontsize=14) plt.ylabel("RMSE", fontsize=14) plt.show()
问题1、2与4的答案
提前终止的目的是为了防止过拟合,如果我们只要返回使验证误差最低的参数,就可以获得验证集误差更低的模型。
图1.学习曲线(横轴为训练轮次,纵轴为负的对数似然)
对图1的注释:
蓝色曲线表示训练集上的loss随着训练轮次的变化而变化的情况。
红色曲线表示测试集上的loss随着训练轮次的变化而变化的情况。
注释:红色曲线是每训练完一个epoch后就测试一次所得到的曲线。
从图中可以看出,测试误差在前几个epoch中逐渐减小,但是训练到某个epoch后,测试误差又有了小幅度的增大。这说明此时发生了过拟合。
发生过拟合是我们所不愿意看见的,我们可以利用提前终止(early stopping)
来防止过拟合的发生。
提前终止是指:在测试误差开始上升之前,就停止训练,即使此时训练尚未收敛(即训练误差未达到最小值)。
首先我们要保存好现在的模型(网络结构和权值),训练num_batch次(即一个epoch),得到新的模型。将测试集作为新模型的输入,进行测试。如果我们发现测试误差比上次得到的测试误差大,我们并不会马上终止测试,而是再继续进行几个epoch的训练与测试,如果测试误差依旧没有减小,那么我们就认为该试验在上一次达到最低测试误差时停下来。具体算法可参见《deep learning》
问题3的答案
该问题是为了回答为什么提前停止可以起到正则化的作用。
首先,我们对损失函数在ω∗ω∗的邻域内用Taylor展开式展开(只展开至二次),则有
J′(ω)=J(ω∗)+1/2(ω−ω∗)TH(ω−ω∗)J′(ω)=J(ω∗)+1/2(ω−ω∗)TH(ω−ω∗)
其中H是Hessian矩阵。这里之所以没有一阶导数的信息,是因为 ω∗ω∗是最优解,在 ω∗ω∗的邻域中,可以近似地认为梯度为0。
对 J′(ω)J′(ω)求梯度,得到
∇ωJ′(ω)=H(ω−ω∗)∇ωJ′(ω)=H(ω−ω∗)
我们将参数向量 ω(0)ω(0)初始化为原点0。由梯度下降法,可以得到如下公式:
ω(τ)=ω(τ–1)−α∇ωĴ (ω(τ−1))ω(τ)=ω(τ–1)−α∇ωĴ(ω(τ−1))
ω(τ)=ω(τ−1)−αH(ω(τ−1)−ω∗)ω(τ)=ω(τ−1)−αH(ω(τ−1)−ω∗)
ω(τ)−ω∗=(I−αH)(ω(τ−1)−ω∗)ω(τ)−ω∗=(I−αH)(ω(τ−1)−ω∗)
将H进行特征值分解: H=QTπQH=QTπQ,其中Q是标准正交矩阵,π是对角矩阵。
那么
ω(τ)−ω∗=QT(I−απ)Q(ω(τ−1)−ω∗)ω(τ)−ω∗=QT(I−απ)Q(ω(τ−1)−ω∗)
Q(ω((τ))−ω∗)=(I−απ)Q(ω((τ−1))−ω∗)Q(ω((τ))−ω∗)=(I−απ)Q(ω((τ−1))−ω∗)
其中 αα足够小以保证|1−απi|<1|1−απi|<1。
Qω(τ)=(I−(I−απ)τ)Qω∗Qω(τ)=(I−(I−απ)τ)Qω∗
在分析L2正则项的时候,Qω̃ =(I−(π+εI)−1ε)Qω∗Qω̃=(I−(π+εI)−1ε)Qω∗
由上面两个式子比较可知,如果下式成立:
(π+εI)−1ε=(I−απ)τ(π+εI)−1ε=(I−απ)τ
则L2正则化和提前终止可以认为是等价的。进一步,有
ε/(πi+ε)=(1−απi)τε/(πi+ε)=(1−απi)τ
两侧取对数,可知:
log(ε/(πi+ε))=τlog(1−απi)log(ε/(πi+ε))=τlog(1−απi)
作一个简单的近似:
−log(1+πi/ε)=τlog(1−απi)−log(1+πi/ε)=τlog(1−απi)
−πi/ε=−ατπi−πi/ε=−ατπi
(比较Taylor展开式的第一个非常数项,Taylor展开式是唯一的)
从而
τ=1/αετ=1/αε
以上的推导说明了提前终止可以起到正则化的作用。
逻辑回归模型的估计概率
p
^
=
h
Θ
(
x
)
=
σ
(
x
T
Θ
)
逻辑记为
σ
(
.
)
,
是一个
s
i
g
m
o
i
d
函数(即
S
型函数),输出一个介于
0
和
1
之间的数字
\widehat{p} = h_{\Theta}(x) = \sigma(x^T\Theta)\\ 逻辑记为\sigma(.),是一个sigmoid函数(即S型函数),输出一个介于0和1之间的数字
p
=hΘ(x)=σ(xTΘ)逻辑记为σ(.),是一个sigmoid函数(即S型函数),输出一个介于0和1之间的数字
逻辑函数
σ
(
t
)
=
1
1
+
e
x
p
(
−
t
)
\sigma(t) = \frac{1}{1+exp(-t)}
σ(t)=1+exp(−t)1
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AhRbsEOJ-1658889211623)(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAADQCAYAAACX3ND9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAwSUlEQVR4nO3daXgUVfr38e9NwqJsgigqEhFlFEUFxXHHUlGWv4M4OMq4sKiDKKigKCIKKiMyDuMDOq64oKIOLuiIyiIqIDoqIFFBaVSEALKFJSQhG8l5XlTS6YQsHeikk/Tvc111dZ+q09V3V046d05VnWPOOUREREQkdtSJdgAiIiIiUrWUAIqIiIjEGCWAIiIiIjFGCaCIiIhIjFECKCIiIhJj4qMdQDhatGjh2rRpE+0wRCRGBQIBAI477rgoR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1wINm9iLwI3CCcy7JOTfbzB4FPqNwHMDQ190CvAhswb+j+OZIDQEjIiI1R3a2n+gtXQrffus/fv+9f9drSVq3hmOPhbZt4ZhjCpc2bfzeO10tIVIxYSWAzrkHgAdK2dyoWN3HgMdK2c92oHfY0YmISK2wcyd88QV8/jksWgSLF5d8TV6bNtChA5x4Ipxwgr8cf7x/3Z2IRI7GlxARkYhLS/PHoJs7FxYuhOXL/TtxQ7VrB6edBqee6j926uRffycilU8JoEiIhQsXMnHiRJYuXcrvv//OSy+9xIABA6Idlki155x/SnfWLJg92+/pC71ur149OP10OPdcOO88OPtsJXsi0aQEUCREWloaHTp0oF+/fvTr1y/a4YhUa87B11/Dm2/C22/7w68UqFMHzjwTuneHCy7wk78DSp1IVESqmhJAkRA9e/akZ8+eAOr5EymBc/71e2++6U8jFjKTIy1b+glf9+5w8cX+8CoiUj1pZCMpol+/fhx66KHBuY7DsXTpUsyMFwrn4hGRWmbjRhg/3r8T94wz4F//8pO/I4/0B6j93//g99/96cH69lXyJ1LdKQGUoCVLljBt2jTuueceGjZsuNf2xx57DDPj9ddfL7L+tNNOo3fv3tx3332kpaVVVbgiUslyc/1r+v78Z38YltGj/QGYjzgCbr/dv6t37Vp47DH/dK8GSxapOfTrKkH33nsvTZo04eabby5x+7fffgv4CV9xo0aNYtOmTTz++OOVGqOIVL4dO/zevrZtoWdPePddf/3ll/sJYVISTJrk38ihpE+kZtKvrgCwatUq5s2bx5VXXskBpVypvXTpUho1akS7du322vbHP/6R448/nmeffZbc3NzKDldEKsH69XDnnZCQ4Pf2JSXB0Uf7yeC6dTBjhn99n+aoFan5lADWYmlpaTz00EN06tSJxo0bY2YlLlu2bOHFF1/EOcdVV121135GjhyJmbFy5UrS0tKIi4sLvnbatGnBen379iUpKYl58+ZV5ccUkf30008wcKDf4/fYY/4YfhdfDHPmwC+/wKhRcPjh0Y5SRCJJdwHXUlu2bOH8889n5cqVnHzyyQwePJisrCzeeustNm3aRN26dUlISKBFixYceuihzJs3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vsYSj71sAqIN7N2IetOKaVutVTB49WPsv+LKvEtAItMtFVvH9tTWZ+5SPvKf77ZOVfS9ag1QjjHyMwMeAH/ouE+zrmcirwFNbgNlaIi3x21rs2EYz/aTG1sL+Eq7bPHZBvKF3N/t/ZBleQ91eIUsJnFm1kDIA6IM7MGIef73wU6mFmf/DpjgO9LOvWQf558BvCQmTU0s3OAy/D/Y61VzOxs/NMMZd1FhZn1yL9eh/wLSO8H/lv5EUaHmR1kZt0K2pCZXQN0AeaU8pJXgBvM7AQzawbcB0ytonCj6WmgPfAn51xGWRVjoQ1V8LtDbaaMNhML7aUkFfzuick2pL9bRZWR+1RN3uOci/qCf4eLK7Y8ELK9K7AS/7bx+UCbkG33ArNCys2B94B0IAm4Otqfr5KO2bPAqyWsT8DvEk7IL08ENucfj9X4Xel1ox1/JR6XQ4DF+N3fO4GvgItLOz756+7IP0a7gJeA+tH+HJV8jI7K/x3LzD8WBcs1sdyGSvvuUJspu83Eansp4RiV+t2jNhT8zPq7VfRzP0ApuQ9VkPdY/otFREREJEZUi1PAIiIiIlJ1lACKiIiIxBglgCIiIiIxRgmgiIiISIxRAigiIiISY5QAioiIiMQYJYAiIiIiMUYJoIhIGfLnVv53tOMQEYkkJYAiIiIiMUYzgYiIlMLMpgL9i60+2jm3puqjERGJHCWAIiKlMLOmwCz8OTnvzV+91TmXG72oRET2X3y0AxARqa6ccylmlg3sds5tinY8IiKRomsARURERGKMEkARERGRGKMEUESkbNlAXLSDEBGJJCWAIiJlWwP80czamFkLM9P3pojUePoiExEp20T8XsAfga1AQnTDERHZfxoGRkRERCTGqAdQREREJMYoARQRERGJMUoARURERGKMEkARERGRGKMEUERERCTGKAEUERERiTFKAEVERERijBJAERERkRjz/wG3/B6/S/i5+QAAAABJRU5ErkJggg==)]
逻辑回归模型预测
y
^
=
{
0
,
如果
p
^
<
0.5
1
,
如果
p
^
>
=
0.5
注意,当
t
<
0
时,
σ
(
t
)
<
0.5
;
t
>
0
时,
σ
(
t
)
>
=
0.5.
如果
x
T
Θ
是正类,逻辑回归模型预测结果是
1
如果是负类,则预测为
0
\widehat{y} =
单个训练实例的成本函数
c
(
Θ
)
=
{
−
l
o
g
(
p
^
)
,
如果
y
=
1
−
l
o
g
(
1
−
p
^
)
,
如果
y
=
0
c(\Theta) =
逻辑回归成本函数(对数损失)
J
(
Θ
)
=
−
1
m
∑
i
=
1
m
[
l
o
g
(
p
^
(
i
)
+
(
1
−
y
i
)
l
o
g
(
1
−
p
^
(
i
)
)
)
]
J(\Theta) = -\frac{1}{m}\sum_{i=1}^{m}[log(\widehat{p}^{(i)}+(1-y^{i})log(1-\widehat{p}^{(i)}))]
J(Θ)=−m1i=1∑m[log(p
(i)+(1−yi)log(1−p
(i)))]
逻辑成本函数偏导数
∂
∂
Θ
j
J
(
Θ
)
=
1
m
∑
i
=
1
m
(
σ
(
Θ
T
x
(
i
)
)
−
y
(
i
)
)
x
j
(
i
)
\frac{\partial}{\partial\Theta_j}J(\Theta) = \frac{1}{m}\sum_{i=1}^{m}(\sigma(\Theta^Tx^{(i)})-y^{(i)})x_j^{(i)}
∂Θj∂J(Θ)=m1i=1∑m(σ(ΘTx(i))−y(i))xj(i)
'''决策边界'''
iris = datasets.load_iris()
x = iris['data'][:,3:]
y = (iris['target']==2).astype(np.int_)
log_reg = LogisticRegression()
log_reg.fit(x,y)
#画图展示模型估算出的概率
x_new = np.linspace(0,3,1000).reshape(-1,1)
y_proba = log_reg.predict_proba(x_new)
plt.plot(x_new,y_proba[:,1],'g-',label = 'Iris virginica')
plt.plot(x_new,y_proba[:,0],'b--',label = 'Not Iris virginica')
plt.show()
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CfEOzzhj-1658889211624)(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXcAAAD7CAYAAACRxdTpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fz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V7S1ufsKlttvjPGG9tRzOY/CDCAeicrzvPmaXAivvCYiIsAU7I/2XY0xmWco6tXX5RzOozCvvC6FhFB0m7tbr4nXJ3djTAr2a8xoEYkSkTZAF+wnemHvA71FpL6IxALPAFNLLNizOJfzEJEbctsZEZG62N4Cc0oy3uKISIiIRADBQLCIRJyhrdNrrwm4fh6+cE1yTQbqAbcYY1LPUs6rrwsunoe3XxcRuUhE7hSRaBEJzu0RcxewoIji7r0mxhivX4BywGwgBdgJdM/dXh37VaZ6gbKPAfuB48C7QLjT8Z/reQAv5p5DCrAV+1Uz1On4C53LSPJ/+c9bRvrgNXHpPHzkmlySG39abux5Sw9fui7nch7efl2AOGAhcCz333k10Cd3n0eviQ4cppRSfsjrm2WUUkqdO03uSinlhzS5K6WUH9LkrpRSfkiTu1JK+SFN7kop5Yc0uSullB/S5K6UUn7o/wHMUy2QU38n9wAAAABJRU5ErkJggg==)]
类k的Softmax分数
s
k
(
x
)
=
x
T
Θ
(
k
)
s_k(x) = x^T\Theta^{(k)}
sk(x)=xTΘ(k)
Softmax函数
p
^
k
=
σ
(
s
(
x
)
)
k
=
e
x
p
(
s
k
(
x
)
)
∑
j
=
1
k
e
x
p
(
s
j
(
x
)
)
此等式中
K
是类数
s
(
x
)
是一个向量,其中包括实例
x
的每个类的分数
σ
(
s
(
x
)
)
k
是实例
x
属于类
k
的估计概率,给定该实例每个类的分数
\widehat{p}_k = \sigma(s(x))_k = \frac{exp(s_k(x))}{\sum_{j=1}^{k}exp(s_j(x))}\\ 此等式中\\K是类数\\s(x)是一个向量,其中包括实例x的每个类的分数\\\sigma(s(x))_k是实例x属于类k的 估计概率,给定该实例每个类的分数
p
k=σ(s(x))k=∑j=1kexp(sj(x))exp(sk(x))此等式中K是类数s(x)是一个向量,其中包括实例x的每个类的分数σ(s(x))k是实例x属于类k的估计概率,给定该实例每个类的分数
Softmax回归分类预测
y
^
=
a
r
g
m
a
x
σ
(
s
(
x
)
)
k
=
a
r
g
m
a
x
s
k
(
x
)
=
a
r
g
m
a
x
(
(
Θ
k
)
T
x
)
\widehat{y} = argmax\sigma(s(x))_k = argmaxs_k(x) = argmax((\Theta^{k})^Tx)
y
=argmaxσ(s(x))k=argmaxsk(x)=argmax((Θk)Tx)
交叉熵成本函数
J
(
Θ
)
=
−
1
m
∑
i
=
1
m
∑
k
=
1
k
y
k
(
i
)
l
o
g
(
p
^
l
(
i
)
)
在此等式中
y
k
(
i
)
是属于类
k
的第
i
个实例的目标概率。一般而言等于
1
或
0
,具体取决于实例是否属于该
J(\Theta) = -\frac{1}{m}\sum_{i=1}^{m}\sum_{k=1}^{k}y_k^{(i)}log(\widehat{p}_l^{(i)}) \\在此等式中y_k^{(i)}是属于类k的第i个实例的目标概率。一般而言等于1或0,具体取决于实例是否属于该
J(Θ)=−m1i=1∑mk=1∑kyk(i)log(p
l(i))在此等式中yk(i)是属于类k的第i个实例的目标概率。一般而言等于1或0,具体取决于实例是否属于该
交叉熵(Cross Entropy)是Shannon信息论中一个重要概念,主要用于度量两个概率分布间的差异性信息。语言模型的性能通常用交叉熵和复杂度(perplexity)来衡量。交叉熵的意义是用该模型对文本识别的难度,或者从压缩的角度来看,每个词平均要用几个位来编码。复杂度的意义是用该模型表示这一文本平均的分支数,其倒数可视为每个词的平均概率。平滑是指对没观察到的N元组合赋予一个概率值,以保证词序列总能通过语言模型得到一个概率值。通常使用的平滑技术有图灵估计、删除插值平滑、Katz平滑和Kneser-Ney平滑。
将交叉熵引入计算语言学消岐领域,采用语句的真实语义作为交叉熵的训练集的先验信息,将机器翻译的语义作为测试集后验信息。计算两者的交叉熵,并以交叉熵指导对歧义的辨识和消除。实例表明,该方法简洁有效.易于计算机自适应实现。交叉熵不失为计算语言学消岐的一种较为有效的工具。
在信息论中,交叉熵是表示两个概率分布p,q,其中p表示真实分布,q表示非真实分布,在相同的一组事件中,其中,用非真实分布q来表示某个事件发生所需要的平均比特数。从这个定义中,我们很难理解交叉熵的定义。下面举个例子来描述一下:
假设现在有一个样本集中两个概率分布p,q,其中p为真实分布,q为非真实分布。假如,按照真实分布p来衡量识别一个样本所需要的编码长度的期望为:
H§=
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DYioVdqB-1658889211625)(https://bkimg.cdn.bcebos.com/formula/d8600ed8a168b3ccde14700c4edba145.svg)]
但是,如果采用错误的分布q来表示来自真实分布p的平均编码长度,则应该是:
H(p,q)=
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lk1m7IsR-1658889211626)(https://bkimg.cdn.bcebos.com/formula/4f4bd894f88b051dbcb362809a886c10.svg)]
此时就将H(p,q)称之为交叉熵。交叉熵的计算方式如下:
对于离散变量采用以下的方式计算:H(p,q)=
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CyFkN1Yr-1658889211626)(https://bkimg.cdn.bcebos.com/formula/39dffa5dea6b891ae6a322110c04ea1a.svg)]
对于连续变量采用以下的方式计算:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-l9Gu7e8Y-1658889211626)(https://bkimg.cdn.bcebos.com/formula/86749cf53f17a226a4e45c56664cae10.svg)]
类k的交叉熵梯度向量
∇
Θ
(
k
)
J
(
Θ
)
=
1
m
∑
i
=
1
m
(
p
^
k
(
i
)
−
y
k
(
i
)
)
x
(
i
)
\nabla_{\Theta(k)}J(\Theta) = \frac{1}{m}\sum_{i=1}^{m}(\widehat{p}_k^{(i)}-y_k^{(i)})x^{(i)}
∇Θ(k)J(Θ)=m1i=1∑m(p
k(i)−yk(i))x(i)
'''Softmax回归''' iris = datasets.load_iris() X= iris["data"][:, (2, 3)] # petal length, petal width y = iris["target"] softmax_reg = LogisticRegression(multi_class="multinomial",solver="lbfgs", C=10, random_state=42) softmax_reg.fit(X, y) x0, x1 = np.meshgrid( np.linspace(0, 8, 500).reshape(-1, 1), np.linspace(0, 3.5, 200).reshape(-1, 1), ) X_new = np.c_[x0.ravel(), x1.ravel()] y_proba = softmax_reg.predict_proba(X_new) y_predict = softmax_reg.predict(X_new) zz1 = y_proba[:, 1].reshape(x0.shape) zz = y_predict.reshape(x0.shape) #画图 plt.figure(figsize=(10, 4)) plt.plot(X[y==2, 0], X[y==2, 1], "g^", label="Iris virginica") plt.plot(X[y==1, 0], X[y==1, 1], "bs", label="Iris versicolor") plt.plot(X[y==0, 0], X[y==0, 1], "yo", label="Iris setosa") from matplotlib.colors import ListedColormap custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0']) plt.contourf(x0, x1, zz, cmap=custom_cmap) contour = plt.contour(x0, x1, zz1, cmap=plt.cm.brg) plt.clabel(contour, inline=1, fontsize=12) plt.xlabel("Petal length", fontsize=14) plt.ylabel("Petal width", fontsize=14) plt.legend(loc="center left", fontsize=14) plt.axis([0, 7, 0, 3.5]) plt.show()
import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression,SGDRegressor,LogisticRegression from sklearn.preprocessing import PolynomialFeatures,StandardScaler from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from sklearn.linear_model import Ridge from sklearn.base import clone from sklearn.pipeline import Pipeline from copy import deepcopy from sklearn import datasets x = 2*np.random.rand(100,1) y = 4+3*x+np.random.randn(100,1) x_b = np.c_[np.ones((100,1)),x] theta_best = np.linalg.inv(x_b.T.dot(x_b)).dot(x_b.T).dot(y) x_new = np.array([[0],[2]]) x_new_b = np.c_[np.ones((2,1)),x_new] y_predict = x_new_b.dot(theta_best) #使用sklearn lin_reg = LinearRegression() lin_reg.fit(x,y) '''批量梯度下降''' eta = 0.1 n_iteration = 1000#迭代次数 m = 100 theta = np.random.randn(2,1) for n in range(n_iteration): gradienters = 2/m*x_b.T.dot(x_b.dot(theta)-y)#偏导计算 theta = theta-eta*gradienters #更改theta '''随机梯度下降''' n_epochs = 50#向前或向后迭代次数 t0,t1 = 5,50 #学习步长超参数 def learning_schedule(t):#计算步长 return t0/(t+t1)#步长逐渐减小 theta = np.random.randn(2,1) for n in range(n_epochs): for i in range(m): random_index = np.random.randint(m) xi = x_b[random_index:random_index+1] yi = y[random_index:random_index+1] gradienters = 2*xi.T.dot(xi.dot(theta)-yi) eta = learning_schedule(n*m+i) theta = theta-eta*gradienters sgd_reg = SGDRegressor(max_iter=1000,tol = 1e-3,penalty=None,eta0=0.1) sgd_reg.fit(x,y.ravel()) print(sgd_reg.intercept_,sgd_reg.coef_) '''小批量梯度下降''' theta_path_mgd = [] n_iterations = 50 minibatch_size = 20 np.random.seed(42) theta = np.random.randn(2,1) # random initialization t0, t1 = 200, 1000 def learning_schedule(t): return t0 / (t + t1) t = 0 for epoch in range(n_iterations): shuffled_indices = np.random.permutation(m) x_b_shuffled = x_b[shuffled_indices] y_shuffled = y[shuffled_indices] for i in range(0, m, minibatch_size): t += 1 xi = x_b_shuffled[i:i+minibatch_size] yi = y_shuffled[i:i+minibatch_size] gradients = 2/minibatch_size * xi.T.dot(xi.dot(theta) - yi) eta = learning_schedule(t) theta = theta - eta * gradients theta_path_mgd.append(theta) '''多项式回归''' m = 100 x = 6*np.random.rand(m,1)-3 y = 0.5*x**2+x+2+np.random.randn(m,1) poly_features = PolynomialFeatures(degree=2,include_bias=False)#聚类特征 x_poly = poly_features.fit_transform(x) lin_reg = LinearRegression() lin_reg.fit(x_poly,y) 画图 X_new=np.linspace(-3, 3, 100).reshape(100, 1) X_new_poly = poly_features.transform(X_new) y_new = lin_reg.predict(X_new_poly) plt.plot(x, y, "b.") plt.plot(X_new, y_new, "r-", linewidth=2, label="Predictions") plt.xlabel("$x_1$", fontsize=18) plt.ylabel("$y$", rotation=0, fontsize=18) plt.legend(loc="upper left", fontsize=14) plt.axis([-3, 3, 0, 10]) plt.show() '''学习曲线''' def plot_learning_curves(model,x,y): x_train,x_val,y_train,y_val = train_test_split(x,y,test_size=0.2) train_erros,val_erros = [],[] for m in range(1,len(x_train)): model.fit(x_train[:m],y_train[:m]) y_train_pred = model.predict(x_train[:m]) y_val_pred = model.predict(x_val) train_erros.append(mean_squared_error(y_train[:m],y_train_pred)) val_erros.append(mean_squared_error(y_val,y_val_pred)) plt.plot(np.sqrt(train_erros),'r-+',linewidth = 2,label = 'train') plt.plot(np.sqrt(val_erros),'b--',linewidth = 3,label = 'val') plt.show() lin_reg = LinearRegression() plot_learning_curves(lin_reg,x,y) '''岭回归''' np.random.seed(42) m = 20 X = 3 * np.random.rand(m, 1) y = 1 + 0.5 * X + np.random.randn(m, 1) / 1.5 X_new = np.linspace(0, 3, 100).reshape(100, 1) ridge_reg = Ridge(alpha=1, solver="cholesky", random_state=42) ridge_reg.fit(X, y) ridge_reg.predict([[1.5]]) ridge_reg = Ridge(alpha=1, solver="sag", random_state=42) ridge_reg.fit(X, y) ridge_reg.predict([[1.5]]) '''lasso''' from sklearn.linear_model import Lasso lasso_reg = Lasso(alpha=0.1) lasso_reg.fit(X, y) lasso_reg.predict([[1.5]]) '''提前停止''' np.random.seed(42) m = 100 x = 6 * np.random.rand(m, 1) - 3 y = 2 + x + 0.5 * x**2 + np.random.randn(m, 1) x_train, x_val, y_train, y_val = train_test_split(x[:50], y[:50].ravel(), test_size=0.5, random_state=10) poly_scaler = Pipeline([('poly_features',PolynomialFeatures(degree=90,include_bias=False)),('std_scaler',StandardScaler())]) x_train_poly_scaled = poly_scaler.fit_transform(x_train) x_val_poly_scaled = poly_scaler.transform(x_val) sgd_reg = SGDRegressor(max_iter=1,tol=-np.infty,warm_start=True,penalty=None,learning_rate='constant',eta0=0.0005) minimum_val_error = float('inf') best_epoch = None best_model = None for epoch in range(1000): sgd_reg.fit(x_train_poly_scaled,y_train) y_val_predict = sgd_reg.predict(x_val_poly_scaled) val_error = mean_squared_error(y_val, y_val_predict) if val_error < minimum_val_error: minimum_val_error = val_error best_epoch = epoch best_model = deepcopy(sgd_reg) #画图 sgd_reg = SGDRegressor(max_iter=1, tol=-np.infty, warm_start=True, penalty=None, learning_rate="constant", eta0=0.0005, random_state=42) n_epochs = 500 train_errors, val_errors = [], [] for epoch in range(n_epochs): sgd_reg.fit(x_train_poly_scaled, y_train) y_train_predict = sgd_reg.predict(x_train_poly_scaled) y_val_predict = sgd_reg.predict(x_val_poly_scaled) train_errors.append(mean_squared_error(y_train, y_train_predict)) val_errors.append(mean_squared_error(y_val, y_val_predict)) best_epoch = np.argmin(val_errors) best_val_rmse = np.sqrt(val_errors[best_epoch]) plt.annotate('Best model', xy=(best_epoch, best_val_rmse), xytext=(best_epoch, best_val_rmse + 1), ha="center", arrowprops=dict(facecolor='black', shrink=0.05), fontsize=16, ) best_val_rmse -= 0.03 # just to make the graph look better plt.plot([0, n_epochs], [best_val_rmse, best_val_rmse], "k:", linewidth=2) plt.plot(np.sqrt(val_errors), "b-", linewidth=3, label="Validation set") plt.plot(np.sqrt(train_errors), "r--", linewidth=2, label="Training set") plt.legend(loc="upper right", fontsize=14) plt.xlabel("Epoch", fontsize=14) plt.ylabel("RMSE", fontsize=14) plt.show() '''决策边界''' iris = datasets.load_iris() x = iris['data'][:,3:] y = (iris['target']==2).astype(np.int_) log_reg = LogisticRegression() log_reg.fit(x,y) #画图展示模型估算出的概率 x_new = np.linspace(0,3,1000).reshape(-1,1) y_proba = log_reg.predict_proba(x_new) plt.plot(x_new,y_proba[:,1],'g-',label = 'Iris virginica') plt.plot(x_new,y_proba[:,0],'b--',label = 'Not Iris virginica') plt.show() '''Softmax回归''' iris = datasets.load_iris() X= iris["data"][:, (2, 3)] # petal length, petal width y = iris["target"] softmax_reg = LogisticRegression(multi_class="multinomial",solver="lbfgs", C=10, random_state=42) softmax_reg.fit(X, y) x0, x1 = np.meshgrid( np.linspace(0, 8, 500).reshape(-1, 1), np.linspace(0, 3.5, 200).reshape(-1, 1), ) X_new = np.c_[x0.ravel(), x1.ravel()] y_proba = softmax_reg.predict_proba(X_new) y_predict = softmax_reg.predict(X_new) zz1 = y_proba[:, 1].reshape(x0.shape) zz = y_predict.reshape(x0.shape) plt.figure(figsize=(10, 4)) plt.plot(X[y==2, 0], X[y==2, 1], "g^", label="Iris virginica") plt.plot(X[y==1, 0], X[y==1, 1], "bs", label="Iris versicolor") plt.plot(X[y==0, 0], X[y==0, 1], "yo", label="Iris setosa") from matplotlib.colors import ListedColormap custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0']) plt.contourf(x0, x1, zz, cmap=custom_cmap) contour = plt.contour(x0, x1, zz1, cmap=plt.cm.brg) plt.clabel(contour, inline=1, fontsize=12) plt.xlabel("Petal length", fontsize=14) plt.ylabel("Petal width", fontsize=14) plt.legend(loc="center left", fontsize=14) plt.axis([0, 7, 0, 3.5]) plt.show()
]
y_proba = softmax_reg.predict_proba(X_new)
y_predict = softmax_reg.predict(X_new)
zz1 = y_proba[:, 1].reshape(x0.shape)
zz = y_predict.reshape(x0.shape)
plt.figure(figsize=(10, 4))
plt.plot(X[y2, 0], X[y2, 1], “g^”, label=“Iris virginica”)
plt.plot(X[y1, 0], X[y1, 1], “bs”, label=“Iris versicolor”)
plt.plot(X[y0, 0], X[y0, 1], “yo”, label=“Iris setosa”)
from matplotlib.colors import ListedColormap
custom_cmap = ListedColormap([‘#fafab0’,‘#9898ff’,‘#a0faa0’])
plt.contourf(x0, x1, zz, cmap=custom_cmap)
contour = plt.contour(x0, x1, zz1, cmap=plt.cm.brg)
plt.clabel(contour, inline=1, fontsize=12)
plt.xlabel(“Petal length”, fontsize=14)
plt.ylabel(“Petal width”, fontsize=14)
plt.legend(loc=“center left”, fontsize=14)
plt.axis([0, 7, 0, 3.5])
plt.show()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。