Example #1
0
            Printing(after_epoch=True)
        ])
    main_loop.run()

    # Save the main loop
    if save_location is not None:
        logger.info('Saving the main loop...')
        dump_manager = MainLoopDumpManager(save_location)
        dump_manager.dump(main_loop)
        logger.info('Saved')


if __name__ == "__main__":
    train_ex = 100
    r_dim = 50

    # Build model
    cost, error_rate = construct_model(Tanh(), r_dim, 30, 2)

    # Build datastream
    train_stream = prepare_data(
        "ARCENE", "train",
        LogregOrderTransposeIt(10, True, 'model_param/logreg_param.pkl', 500))

    # Train the model
    train_model(cost,
                error_rate,
                train_stream,
                load_location=None,
                save_location=None)
Example #2
0
            Printing(every_n_epochs=1*config.pt_freq, after_epoch=False),
            Plot(document='tr_'+model_name+'_'+config.param_desc,
                 channels=[['train_cost', 'train_cost_reg', 'valid_cost'],
                           ['train_ber', 'train_ber_reg', 'valid_ber']],
                 server_url='http://eos21:4201',
                 every_n_epochs=1*config.pt_freq, after_epoch=False),

            FinishAfter(every_n_epochs=10000)
        ]
    )
    main_loop.run()


if __name__ == "__main__":
    # Build datastream
    ref_data, train_stream, valid_stream, test_stream = prepare_data(config)

    # Build model
    m = config.Model(ref_data, 2)
    m.cost.name = 'cost'
    m.cost_reg.name = 'cost_reg'
    m.ber.name = 'ber'
    m.ber_reg.name = 'ber_reg'
    m.pred.name = 'pred'
    m.confidence.name = 'confidence'

    # Train the model
    saveloc = 'model_data/%s-%s' % (model_name, config.param_desc)
    train_model(m, train_stream, valid_stream,
                load_location=None, save_location=None)
            DataStreamMonitoring([cost], train_stream, prefix='train',
                                 after_epoch=True),
            Printing(after_epoch=True)
        ]
    )
    main_loop.run()

    # Save the main loop
    if save_location is not None:
        logger.info('Saving the main loop...')
        dump_manager = MainLoopDumpManager(save_location)
        dump_manager.dump(main_loop)
        logger.info('Saved')


if __name__ == "__main__":
    train_ex = 100
    r_dim = 50

    # Build model
    cost, error_rate = construct_model(Tanh(), r_dim, 30, 2)

    # Build datastream
    train_stream = prepare_data("ARCENE", "train",
                                LogregOrderTransposeIt(10, True,
                                                       'model_param/logreg_param.pkl', 500))

    # Train the model
    train_model(cost, error_rate, train_stream, load_location=None,
                save_location=None)
Example #4
0
                                 every_n_epochs=5 * config.pt_freq),
            Printing(every_n_epochs=1 * config.pt_freq, after_epoch=False),
            Plot(document='tr_' + model_name + '_' + config.param_desc,
                 channels=[['train_cost', 'train_cost_reg', 'valid_cost'],
                           ['train_ber', 'train_ber_reg', 'valid_ber']],
                 server_url='http://eos21:4201',
                 every_n_epochs=1 * config.pt_freq,
                 after_epoch=False),
            FinishAfter(every_n_epochs=10000)
        ])
    main_loop.run()


if __name__ == "__main__":
    # Build datastream
    ref_data, train_stream, valid_stream, test_stream = prepare_data(config)

    # Build model
    m = config.Model(ref_data, 2)
    m.cost.name = 'cost'
    m.cost_reg.name = 'cost_reg'
    m.ber.name = 'ber'
    m.ber_reg.name = 'ber_reg'
    m.pred.name = 'pred'
    m.confidence.name = 'confidence'

    # Train the model
    saveloc = 'model_data/%s-%s' % (model_name, config.param_desc)
    train_model(m,
                train_stream,
                valid_stream,