Skip to content

Commit

Permalink
best: rm age + log(age)
Browse files Browse the repository at this point in the history
  • Loading branch information
orbxball committed Apr 4, 2017
1 parent f2f4018 commit a0caf6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hw2/best.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ def makeValidation(X, Y):
Y_train = Y_train.reshape(Y_train.shape[0]) #shape: (32561,)

## X_train select
one = [i for i in range(1, X_test.shape[1])]
square = [0, 1, 3, 4, 5]
cubic = [0, 1, 3, 4, 5]
X_train = np.concatenate((X_train,
X_train = np.concatenate((X_train[:, one],
X_train[:, square]**2,
X_train[:, cubic]**3,
np.log(X_train[:, [0, 3]] + 1e-100)), axis=1)
np.log(X_train[:, [3]] + 1e-100)), axis=1)

# scaling: only on features, not label
mean = np.mean(X_train, axis=0) #shape: (106,)
Expand Down Expand Up @@ -100,10 +101,10 @@ def makeValidation(X, Y):
file.write('id,label\n')

# X_test select
X_test = np.concatenate((X_test,
X_test = np.concatenate((X_test[:, one],
X_test[:, square]**2,
X_test[:, cubic]**3,
np.log(X_test[:, [0, 3]] + 1e-100)), axis=1)
np.log(X_test[:, [3]] + 1e-100)), axis=1)
ans = []
for i in range(X_test.shape[0]):
Z = X_test[i]
Expand Down

0 comments on commit a0caf6a

Please sign in to comment.