资源简介
莫烦深度学习 Python + Keras视频课程的源代码 kerasTUT
代码片段和文件信息
“““
To know more or get code samples please visit my website:
https://morvanzhou.github.io/tutorials/
Or search: 莫烦Python
Thank you for supporting!
“““
# please note all tutorial code are running under python3.5.
# If you use the version like python2.7 please modify the code accordingly
# 10 - save
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.models import Sequential
from keras.layers import Dense
from keras.models import load_model
# create some data
X = np.linspace(-1 1 200)
np.random.shuffle(X) # randomize the data
Y = 0.5 * X + 2 + np.random.normal(0 0.05 (200 ))
X_train Y_train = X[:160] Y[:160] # first 160 data points
X_test Y_test = X[160:] Y[160:] # last 40 data points
model = Sequential()
model.add(Dense(output_dim=1 input_dim=1))
model.compile(loss=‘mse‘ optimizer=‘sgd‘)
for step in range(301):
cost = model.train_on_batch(X_train Y_train)
# save
print(‘test before save: ‘ model.predict(X_test[0:2]))
model.save(‘my_model.h5‘) # HDF5 file you have to pip3 install h5py if don‘t have it
del model # deletes the existing model
# load
model = load_model(‘my_model.h5‘)
print(‘test after load: ‘ model.predict(X_test[0:2]))
“““
# save and load weights
model.save_weights(‘my_model_weights.h5‘)
model.load_weights(‘my_model_weights.h5‘)
# save and load fresh network without trained weights
from keras.models import model_from_json
json_string = model.to_json()
model = model_from_json(json_string)
“““
相关资源
- deep learning with python 中文版
- Python-Keras实现Inceptionv4InceptionResnetv1和
- Python-基于深度学习的语音增强使用
- python+keras+deeplearning
- MLP/RNN/LSTM模型进行IMDb情感分析
- 10行Python代码实现目标检测
- [PDF] Reinforcement Learning With Open AI Tens
- 基于Keras的attention实战
- keras实现中文文本分类
- python深度学习-高清pdf-源码
- 亚马逊电子书-Keras快速上手:基于P
- 《Python深度学习》2018中文版pdf+英文版
- Python深度学习.pdf
- keras 实现的表情识别
- 《python深度学习》弗朗索瓦肖莱 高清
- python深度学习pdf+源码案例
- Python深度学习实战 基于tensorflow和k
- Reinforcement Learning - With Open AI TensorFl
- Python深度学习Deep Learning With Python中文
- Keras快速上手基于Python的深度学习实战
- 《Python深度学习》中文版pdf+英文版
- Hands-On Machine Learning with Scikit-Learn Ke
- keras快速上手 基于python深度学习实战
- keras之父之作《Python深度学习》2018中
- Deep Learning for Computer Vision Expert techn
- resnet50_weights_tf_dim_ordering_tf_kernels_no
- Windows-Tensorflow2.0.0-Keras2.3.1.zip
- Python-基于Tensorflow和Keras实现端到端的
- keras2.0中文文档
- Python-利用keras模仿汪峰生成歌词
评论
共有 条评论