예제 #1
0
    def build_model(self):
        model = Sequential()
        model.add(Dropout(0.1, input_shape=(nn_input_dim_NN, )))
        model.add(
            Dense(input_dim=nn_input_dim_NN, output_dim=110, init='he_normal'))
        model.add(PReLU(init='zero'))
        model.add(BatchNormalization())
        model.add(Dropout(0.2))
        model.add(Dense(input_dim=110, output_dim=350, init='he_normal'))
        model.add(PReLU(init='zero'))
        model.add(BatchNormalization())
        model.add(Dropout(0.6))
        model.add(Dense(input_dim=350, output_dim=150, init='he_normal'))
        model.add(PReLU(init='zero'))
        model.add(BatchNormalization())
        model.add(Dropout(0.6))
        model.add(Dense(input_dim=150, output_dim=20, init='he_normal'))
        model.add(PReLU(init='zero'))
        model.add(BatchNormalization())
        model.add(Dropout(0.2))
        model.add(
            Dense(input_dim=20,
                  output_dim=2,
                  init='he_normal',
                  activation='softmax'))
        sgd = SGD(lr=0.02, decay=1e-10, momentum=0.9, nesterov=True)

        model.compile(optimizer=sgd,
                      loss='binary_crossentropy',
                      class_mode='binary')

        return KerasClassifier(nn=model, **self.params)
예제 #2
0
    def build_model(self):
        model = Sequential()
        model.add(Dropout(0.1, input_shape=(nn_input_dim_NN, )))
        model.add(
            Dense(input_dim=nn_input_dim_NN, output_dim=62, init='he_normal'))
        model.add(LeakyReLU(alpha=.001))
        model.add(Dropout(0.3))
        model.add(Dense(input_dim=62, output_dim=158, init='he_normal'))
        model.add(LeakyReLU(alpha=.001))
        model.add(Dropout(0.25))
        model.add(Dense(input_dim=158, output_dim=20, init='he_normal'))
        model.add(PReLU(init='zero'))
        model.add(Dropout(0.2))
        model.add(
            Dense(input_dim=20,
                  output_dim=2,
                  init='he_normal',
                  activation='softmax'))
        #model.add(Activation('softmax'))
        sgd = SGD(lr=0.05, decay=1e-6, momentum=0.9, nesterov=True)

        model.compile(optimizer=sgd,
                      loss='binary_crossentropy',
                      class_mode='binary')

        return KerasClassifier(nn=model, **self.params)
예제 #3
0
    def build_model(self):
        model = Sequential()
        model.add(Dropout(0.2, input_shape=(nn_input_dim_NN, )))
        model.add(
            Dense(input_dim=nn_input_dim_NN, output_dim=140, init='uniform'))
        model.add(LeakyReLU(alpha=.00001))
        model.add(BatchNormalization())
        model.add(Dropout(0.6))
        model.add(Dense(input_dim=140, output_dim=250, init='uniform'))
        model.add(LeakyReLU(alpha=.00001))
        model.add(BatchNormalization())
        model.add(Dropout(0.6))
        model.add(
            Dense(input_dim=250,
                  output_dim=90,
                  init='uniform',
                  activation='relu'))
        model.add(BatchNormalization())
        model.add(Dropout(0.4))
        model.add(
            Dense(input_dim=90,
                  output_dim=2,
                  init='uniform',
                  activation='softmax'))
        #model.add(Activation('softmax'))
        sgd = SGD(lr=0.013, decay=1e-6, momentum=0.9, nesterov=True)

        model.compile(optimizer=sgd,
                      loss='binary_crossentropy',
                      class_mode='binary')

        return KerasClassifier(nn=model, **self.params)
예제 #4
0
파일: binary.py 프로젝트: Lirunhua/stacking
        def build_model(self):
            model = Sequential()
            model.add(Dense(64, input_shape=nn_input_dim_NN, init='he_normal'))
            model.add(LeakyReLU(alpha=.00001))
            model.add(Dropout(0.5))
                        
            model.add(Dense(2, init='he_normal'))
            model.add(Activation('softmax'))
            sgd = SGD(lr=0.1, decay=1e-5, momentum=0.9, nesterov=True)

            model.compile(optimizer=sgd, loss='binary_crossentropy', metrics=["accuracy"])

            return KerasClassifier(nn=model,**self.params)