Created
July 22, 2017 13:06
-
-
Save adash333/bde4537c0607c7673480bfe70eaa1370 to your computer and use it in GitHub Desktop.
This file contains 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
# 3.5 多クラスロジスティック回帰 Keras 、モデルと学習結果の読み込みと予測 | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation | |
from keras.optimizers import SGD | |
from sklearn.utils import shuffle | |
from keras.models import model_from_json | |
# モデルを読み込む | |
model = model_from_json(open('my_model35.json').read()) | |
# 学習結果を読み込む | |
model.load_weights('my_model35.hdf5') | |
model.summary(); | |
X = np.array([[0, 8], [6, 6], [10, 8], [10, -2]]) | |
prediction = model.predict(X) | |
print(prediction[0]) | |
print(prediction[1]) | |
print(prediction[2]) | |
print(prediction[3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment