def first_hid_rec(value, good_data, bad_data):
    build_network = buildNetwork(len(good_data[0]), value, 2,
                                 bias=True,
                                 hiddenclass=SigmoidLayer,
                                 outclass=SoftmaxLayer,
                                 recurrent=True)

    trainer = BackpropTrainer(build_network,
                              get_supervised_data_set(good_data, bad_data))
    result = trainer.trainUntilConvergence()
    return result[0][-1]
def third_hidden_lvl(first_hidd, second_hidd, value, good_data, bad_data):
    build_network = buildNetwork(len(good_data[0]),
                                 first_hidd,
                                 second_hidd,
                                 value,
                                 2,
                                 bias=True,
                                 hiddenclass=SigmoidLayer,
                                 outclass=SoftmaxLayer)

    trainer = BackpropTrainer(build_network,
                              get_supervised_data_set(good_data, bad_data))
    result = trainer.trainUntilConvergence()
    return result[0][-1]
def get_third_nn(value, good_data, bad_data):
    build_network = FeedForwardNetwork()
    inLayer = LinearLayer(len(good_data[0]))
    hiddenLayer = SigmoidLayer(value)
    outLayer = SigmoidLayer(1)

    build_network.addInputModule(inLayer)
    build_network.addModule(hiddenLayer)
    build_network.addOutputModule(outLayer)

    in_to_hidden = FullConnection(inLayer, hiddenLayer)
    hidden_to_out = FullConnection(hiddenLayer, outLayer)
    in_to_out = FullConnection(inLayer, outLayer)

    build_network.addConnection(in_to_hidden)
    build_network.addConnection(hidden_to_out)
    build_network.addConnection(in_to_out)

    build_network.sortModules()
    trainer = BackpropTrainer(build_network,
                              get_supervised_data_set(good_data, bad_data))

    result = trainer.trainUntilConvergence()
    return result[0][-1]
Пример #4
0
def hidden0_tst(good_data, n, bad_file):
    net = buildNetwork(len(good_data[0]), n, 2)
    trainer = BackpropTrainer(net,
                              get_supervised_data_set(good_data, bad_file))
    # trainer.trainUntilConvergence()
    return trainer