Theano 学习资源较少
不建议使用theano做pre-train
资源
theano学习之模型的保存和提取_水月清的博客-CSDN博客_theano 保存模型
Save 保存 提取 - Theano | 莫烦Python
save model
# save model
with open('save/model.pickle', 'wb') as file:
model = [w.get_value(), b.get_value()]
pickle.dump(model, file)
print(model[0][:10])
print("accuracy:", compute_accuracy(D[1], predict(D[0])))
"""
[-0.15707296 0.14590665 -0.08451091 -0.12594476 -0.13424085 -0.33887753
0.12650858 0.20702686 0.0549835 0.29920542]
accuracy: 1.0
"""
load model
# load model
with open('save/model.pickle', 'rb') as file:
model = pickle.load(file)
w.set_value(model[0])
b.set_value(model[1])
print(w.get_value()[:10])
print("accuracy:", compute_accuracy(D[1], predict(D[0])))
"""
[-0.15707296 0.14590665 -0.08451091 -0.12594476 -0.13424085 -0.33887753
0.12650858 0.20702686 0.0549835 0.29920542]
accuracy: 1.0
"""