0
我的同事和關於交叉驗證的這個問題說你應該將數據轉換爲神經網絡的零均值和單位方差。但是,我的表現比縮放稍微差一些。是否需要爲skflow.TensorFlowDNNClassifier縮放數據?
我試着使用:
scaler = preprocessing.StandardScaler().fit(X_train)
X_train = scaler.transform(X_train)
X_test = scaler.transform(X_test)
steps = 5000
def exp_decay(global_step):
return tf.train.exponential_decay(
learning_rate=0.1, global_step=global_step,
decay_steps=steps, decay_rate=0.01)
random.seed(42) # to sample data the same way
classifier = skflow.TensorFlowDNNClassifier(
hidden_units=[150, 150, 150],
n_classes=2,
batch_size=128,
steps=steps,
learning_rate=exp_decay)
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
難道我做錯事或脫屑沒有必要?