标签:required 比较 直接 turn api def metrics 实用 input
|
![tensorflow ](https://img-blog.csdnimg.cn/20190825125400589.png#==#pic_center =40x)TensorFlow|
![keras](https://img-blog.csdnimg.cn/20190804140154168.png#==#pic_center =40x)Keras |
---|
python & mathematics
sudo pip install keras
backend : tensorflow
dependencies:
cuDNN (recommended if you plan on running Keras on GPU).
HDF5 and h5py (required if you plan on saving Keras models to disk).
graphviz and pydot (used by visualization utilities to plot model graphs).
其实用tensorflow是可以的
我也比较推荐直接使用tensorflow
因为keras其实是tensorflow的高阶API
用tensorflow能够使得传统的keras程序有较好的扩展性。
不仅能够使用keras中的特性也能受益于tensorflow
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layouts
def build_model():
model = keras.Sequential([
layers.Dense(64, activation=tf.nn.relu, input_shape=[len(train_dataset.keys())]),
layers.Dense(64, activation=tf.nn.relu),
layers.Dense(1)
])
optimizer = tf.keras.optimizers.RMSprop(0.001)
model.compile(loss=‘mean_squared_error‘,
optimizer=optimizer,
metrics=[‘mean_absolute_error‘, ‘mean_squared_error‘])
return model
标签:required 比较 直接 turn api def metrics 实用 input
原文地址:https://www.cnblogs.com/wykxldz/p/13192454.html