Skip to content

Instantly share code, notes, and snippets.

@adash333
Created July 22, 2017 13:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save adash333/bde4537c0607c7673480bfe70eaa1370 to your computer and use it in GitHub Desktop.
Save adash333/bde4537c0607c7673480bfe70eaa1370 to your computer and use it in GitHub Desktop.
# 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