代码拉取完成,页面将自动刷新
import os
import keras
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from keras.models import Model
from keras.layers import *
from matplotlib import pyplot
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from keras.layers import Dense,Dropout,Activation,Convolution2D,MaxPooling2D,Flatten
from keras.layers import LSTM
def design_model():
# design network
inp=Input(shape=(11,5))
reshape=Reshape((11,5,1))(inp)
conv1=Convolution2D(32,3,3,border_mode='same',init='glorot_uniform')(reshape)
print(conv1)
l1=Activation('relu')(conv1)
conv2=Convolution2D(64,3,3, border_mode='same',)(l1)
l2=Activation('relu')(conv2)
print(l2)
m2=MaxPooling2D(pool_size=(2, 2), border_mode='valid')(l2)
print(m2)
reshape1=Reshape((10,64))(m2)
lstm1=LSTM(input_shape=(10,64),output_dim=30,activation='tanh',return_sequences=False)(reshape1)
dl1=Dropout(0.3)(lstm1)
# den1=Dense(100,activation="relu")(dl1)
den2=Dense(1,activation="relu")(dl1)
model=Model(input=inp,outputs=den2)
model.summary() #打印出模型概况
adam = keras.optimizers.Adam(lr = 0.001, beta_1=0.95, beta_2=0.999,epsilon=1e-08)
model.compile(loss=["mae"], optimizer=adam,metrics=['mape'])
return model
if __name__ == '__main__':
design_model()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。