标签:dom max == randn oss pytho oat 方案 for
bestloss = float(‘inf‘) # 无穷大
for num in range(1000):
W = np.random.randn(10, 3073) * 0.0001
loss = L(X_train, Y_train, W)
if loss < bestloss:
bestloss = loss
bestW = W
scores = bsetW.dot(Xte_cols)
Yte_predict = np.argmax(score, axis = 0)
np.mean(Yte_predict == Yte)
核心思路:迭代优化
W = np.random.randn(10, 3073) * 0.001
bestloss = float(‘inf‘)
for i in range(1000):
step_size = 0.0001
Wtry = np.random.randn(10, 3073) * step_size
loss = L(Xtr_cols, Ytr, Wtry)
if loss < bestloss:
W = Wtry
bestloss = loss
标签:dom max == randn oss pytho oat 方案 for
原文地址:http://www.cnblogs.com/hellcat/p/6979951.html