Skip to content

Commit 950f410

Browse files
remove irrelevant comments
1 parent 91ae456 commit 950f410

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

airline/ann.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,24 +156,15 @@ def predict(self, X):
156156
X[:,d] = series[d:d+n]
157157
Y = series[D:D+n]
158158

159-
# print "X.shape:", X.shape
160-
# print "Y.shape:", Y.shape
161-
162159
print "series length:", n
163160
Xtrain = X[:n/2]
164161
Ytrain = Y[:n/2]
165162
Xtest = X[n/2:]
166163
Ytest = Y[n/2:]
167164

168-
# print "Xtrain.shape:", Xtrain.shape
169-
# print "Ytrain.shape:", Ytrain.shape
170-
171165
model = ANN([200])
172166
model.fit(Xtrain, Ytrain, activation=T.tanh)
173167
print "train score:", model.score(Xtrain, Ytrain)
174-
175-
# print "Xtest.shape:", Xtest.shape
176-
# print "Ytest.shape:", Ytest.shape
177168
print "test score:", model.score(Xtest, Ytest)
178169

179170
# plot the prediction with true values

airline/lr.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
# let's try with only the time series itself
2323
series = df.num_passengers.as_matrix()
2424

25-
# def myr2(T, Y, Ym):
26-
# sse = (T - Y).dot(T - Y)
27-
# sst = (T - Ym).dot(T - Ym)
28-
# return 1 - sse / sst
29-
3025
# let's see if we can use D past values to predict the next value
3126
N = len(series)
3227
for D in (2,3,4,5,6,7):
@@ -36,33 +31,17 @@
3631
X[:,d] = series[d:d+n]
3732
Y = series[D:D+n]
3833

39-
# print "X.shape:", X.shape
40-
# print "Y.shape:", Y.shape
41-
4234
print "series length:", n
4335
Xtrain = X[:n/2]
4436
Ytrain = Y[:n/2]
4537
Xtest = X[n/2:]
4638
Ytest = Y[n/2:]
4739

48-
# print "Xtrain.shape:", Xtrain.shape
49-
# print "Ytrain.shape:", Ytrain.shape
50-
5140
model = LinearRegression()
5241
model.fit(Xtrain, Ytrain)
5342
print "train score:", model.score(Xtrain, Ytrain)
54-
55-
# Ytrain_mean = Ytrain.mean()
56-
# print "myr2 train:", myr2(Ytrain, model.predict(Xtrain), Ytrain_mean)
57-
58-
# print "Xtest.shape:", Xtest.shape
59-
# print "Ytest.shape:", Ytest.shape
6043
print "test score:", model.score(Xtest, Ytest)
6144

62-
# Ytest_mean = Ytest.mean()
63-
# print "myr2 test w/ Ytrain mean:", myr2(Ytest, model.predict(Xtest), Ytrain_mean)
64-
# print "myr2 test w/ Ytest mean:", myr2(Ytest, model.predict(Xtest), Ytest_mean) # this is the one score uses
65-
6645
# plot the prediction with true values
6746
plt.plot(series)
6847

airline/rnn.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ def fit(self, X, Y, activation=T.tanh, learning_rate=10e-2, mu=0.5, reg=0, epoch
8686

8787
c = self.train_op(learning_rate, X[j], Y[j])
8888
cost += c
89-
90-
# if (j+1) % 200 == 0:
91-
# sys.stdout.write("j/N: %d/%d cost so far: %f\r" % (j, N, cost))
92-
# sys.stdout.flush()
9389
if i % 10 == 0:
9490
print "i:", i, "cost:", cost, "time for epoch:", (datetime.now() - t0)
9591
if (i+1) % 500 == 0:
@@ -145,9 +141,6 @@ def predict(self, X):
145141
X[:,d] = series[d:d+n]
146142
Y = series[D:D+n]
147143

148-
# print "X.shape:", X.shape
149-
# print "Y.shape:", Y.shape
150-
151144
print "series length:", n
152145
Xtrain = X[:n/2]
153146
Ytrain = Y[:n/2]
@@ -159,15 +152,9 @@ def predict(self, X):
159152
Ntest = len(Xtest)
160153
Xtest = Xtest.reshape(Ntest, D, 1)
161154

162-
# print "Xtrain.shape:", Xtrain.shape
163-
# print "Ytrain.shape:", Ytrain.shape
164-
165155
model = RNN([50])
166156
model.fit(Xtrain, Ytrain, activation=T.tanh)
167157
print "train score:", model.score(Xtrain, Ytrain)
168-
169-
# print "Xtest.shape:", Xtest.shape
170-
# print "Ytest.shape:", Ytest.shape
171158
print "test score:", model.score(Xtest, Ytest)
172159

173160
# plot the prediction with true values

0 commit comments

Comments
 (0)