Skip to content

Commit a24b8fa

Browse files
i forget
1 parent cd8ba73 commit a24b8fa

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.DS_Store
12
*.pyc
23
large_files
34
large_files/*

ann_class2/rmsprop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def main():
8282
cache_W1 = 0
8383
cache_b1 = 0
8484
decay_rate = 0.999
85-
eps = 0.000001
85+
eps = 0.0000000001
8686
for i in xrange(max_iter):
8787
for j in xrange(n_batches):
8888
Xbatch = Xtrain[j*batch_sz:(j*batch_sz + batch_sz),]

ann_class2/tensorflow2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main():
2626
print_period = 10
2727

2828
lr = 0.00004
29-
mu = 0.9
29+
reg = 0.01
3030

3131
Xtrain = X[:-1000,]
3232
Ytrain = Y[:-1000]
@@ -94,7 +94,7 @@ def main():
9494
test_cost = session.run(cost, feed_dict={X: Xtest, T: Ytest_ind})
9595
prediction = session.run(predict_op, feed_dict={X: Xtest})
9696
err = error_rate(prediction, Ytest)
97-
print "Cost / err at iteration i=%d, j=%d: %.6f / %.3f" % (i, j, test_cost, err)
97+
print "Cost / err at iteration i=%d, j=%d: %.3f / %.3f" % (i, j, test_cost, err)
9898
LL.append(test_cost)
9999

100100
plt.plot(LL)

ann_class2/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def benchmark_pca():
206206
# D = 300 -> error = 0.07
207207
lr = 0.0001
208208
reg = 0.01
209-
for i in xrange(800):
209+
for i in xrange(200):
210210
p_y = forward(Xtrain, W, b)
211211
# print "p_y:", p_y
212212
ll = cost(p_y, Ytrain_ind)
@@ -235,6 +235,6 @@ def benchmark_pca():
235235

236236

237237
if __name__ == '__main__':
238-
# benchmark_pca()
239-
benchmark_full()
238+
benchmark_pca()
239+
# benchmark_full()
240240

logistic_regression_class/logistic_donut.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ def sigmoid(z):
5353

5454
# calculate the cross-entropy error
5555
def cross_entropy(T, Y):
56-
E = 0
57-
for i in xrange(N):
58-
if T[i] == 1:
59-
E -= np.log(Y[i])
60-
else:
61-
E -= np.log(1 - Y[i])
62-
return E
56+
# E = 0
57+
# for i in xrange(N):
58+
# if T[i] == 1:
59+
# E -= np.log(Y[i])
60+
# else:
61+
# E -= np.log(1 - Y[i])
62+
# return E
63+
return (T*np.log(Y) + (1-T)*np.log(1-Y)).sum()
6364

6465

6566
# let's do gradient descent 100 times

0 commit comments

Comments
 (0)