Skip to main content

README

keras.layers

全连接层 keras.layers.Dense CNN keras.layers.Conv2D(N, kernel_shape, padding, activation) RNN keras.layers.SimpleRNN(N, activation="") Dropout keras.layers.Dropout(rate, seed="") 概率

Keras.models

创建模型 Keras.models.Sequential() 模型训练/预测 Model.fit()/Model.predict() 保存/加载模型 Model.save()/Keras.models.load() 加载有条件限制

optimizers 优化器

from keras import optimizers

  • optimizers.SGD(lr=0.01, momentum=0.0, decay=0.0, nesterov=False)
  • optimizers.RMSprop(lr=0.001, rho=0.9, epsilon=None, decay=0.0)
  • optimizers.Adadelta(lr=1.0, rho=0.95, epsilon=None, decay=0.0)
  • optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0)

activations 激活函数

activation.softmax activation.relu activation.tanh 双曲线,缺点,正无穷和负无穷的时候,梯度消失 activation.elu

数据集

CIFAR10 from keras.datasets import cifar10 IMDB from keras.datasets import imdb 波斯顿房价 from keras.datasets import boston_housing newswire话题分类 from keras.datasets import reuters

创建模型

model.Sqeuential(n, input_shape)

Model = model.Sqeuential() Model.add(layers.Dense(n, input_shape))

InputShape = Input() Layer1 = layers.Decse(n)(InputShape)

参考