Skip to content

Commit

Permalink
shuffle the dataset first
Browse files Browse the repository at this point in the history
  • Loading branch information
CorcovadoMing committed May 15, 2015
1 parent 8fcd9bf commit 4f50a96
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DeepLearning Tutorials/dive_into_keras/cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def create_model():
sgd = SGD(l2=0.0,lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd)

index = [i for i in range(len(data))]
random.shuffle(index)
data = data[index]
label = label[index]
(X_train,X_val) = (data[0:30000],data[30000:])
(Y_train,Y_val) = (label[0:30000],label[30000:])
best_accuracy = 0.0
Expand Down

0 comments on commit 4f50a96

Please sign in to comment.