def keras_mlp2(train2, y, test2, v, z):
from keras import layers
from keras import models
from keras import optimizers
cname = sys._getframe().f_code.co_name
num_splits = 9
scaler = preprocessing.RobustScaler()
train3 = scaler.fit_transform(train2)
test3 = scaler.transform(test2)
input_dims = train3.shape[1]
def build_model():
input_ = layers.Input(shape=(input_dims,))
model = layers.Dense(1024, kernel_initializer='Orthogonal')(input_)
model = layers.Activation('selu')(model)
model = layers.Dense(128, kernel_initializer='Orthogonal')(model)
model = layers.Activation('selu')(model)
model = layers.Dense(16, kernel_initializer='Orthogonal')(model)
model = layers.Activation('selu')(model)
model = layers.Dense(1, activation='sigmoid')(model)
model = models.Model(input_, model)
model.compile(loss = 'binary_crossentropy', optimizer = optimizers.RMSprop())
#print(model.summary(line_length=120))
return model
keras_common(train3, y, test3, v, z, num_splits, cname, build_model)
评论列表
文章目录