Created
July 7, 2017 20:35
-
-
Save nesterione/25d4a0e01dc441b72f1350afc782e6e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| from keras.models import load_model | |
| model = load_model('./nn_dence.h5') | |
| model.load_weights('./nn_dence_weights.h5') | |
| # model = load_model('./nn_cnn.h5') | |
| # model.load_weights('./nn_cnn_weights.h5') | |
| # ImageId,Label | |
| # np.array(tk.texts_to_sequences(text)) | |
| data = pd.read_csv("./data/test.csv") | |
| data_set = data.as_matrix() | |
| X_test = data_set | |
| # X_test = np.reshape(X_test,(X_test.shape[0],28,28,1)) | |
| print(X_test.shape) | |
| # normalize | |
| x_train = X_test.astype('float32') | |
| x_train /= 255 | |
| prediction = model.predict_classes(x_train) | |
| with open('result.csv', 'w') as f: | |
| f.write('ImageId,Label\n') | |
| for i, v in enumerate(prediction): | |
| f.write(str(i+1)+","+str(v)+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment