Пример #1
0
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)

    lr_params = lr_default_params()
    config = estimator_default_config()

    ds_obj = lr_params['ds_obj']
    model_dir = lr_params['model_dir']
    num_epochs = 20
    batch_size = 32
    model_params = lr_params['model_params']
    print(model_params)

    if os.path.exists(model_dir): shutil.rmtree(model_dir)  # clean model_dir
    model_fn = make_model_fn(lr_arch_fn)
    LR = tf.estimator.Estimator(model_fn=model_fn,
                                model_dir=model_dir,
                                params=model_params,
                                config=config)

    LR.train(lambda: input_fn(ds_obj.file_tr, batch_size, num_epochs, True))
    print('eval in tr dataset')
    LR.evaluate(lambda: input_fn(ds_obj.file_tr, batch_size, 1))
    print('eval in va dataset')
    LR.evaluate(lambda: input_fn(ds_obj.file_va, batch_size, 1))
    """
    eval in tr dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.78388655, auc = 0.7319471, global_step = 56227, loss = 0.4900751
    eval in va dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7866109, auc = 0.7285157, global_step = 56227, loss = 0.48628032
Пример #2
0
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)

    params = xDeepFM_default_params()
    config = estimator_default_config()

    ds_obj = params['ds_obj']
    model_dir = params['model_dir']
    num_epochs = 20
    batch_size = 32
    model_params = params['model_params']
    print(model_params)

    if os.path.exists(model_dir): shutil.rmtree(model_dir)  # clean model_dir
    model_fn = make_model_fn(xDeepFM_arch_fn)
    xDeepFM = tf.estimator.Estimator(model_fn=model_fn, model_dir=model_dir, params=model_params, config=config)

    xDeepFM.train(lambda: input_fn(ds_obj.file_tr, batch_size, num_epochs, True))
    print('eval in tr dataset')
    xDeepFM.evaluate(lambda: input_fn(ds_obj.file_tr, batch_size, 1))
    print('eval in va dataset')
    xDeepFM.evaluate(lambda: input_fn(ds_obj.file_va, batch_size, 1))

    """
    eval in tr dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7805073, auc = 0.76424193, global_step = 56227, loss = 0.4829209
    eval in va dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.78272563, auc = 0.75082505, global_step = 56227, loss = 0.49588004
    """
Пример #3
0
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)

    params = DCN_default_params()
    config = estimator_default_config()

    ds_obj = params['ds_obj']
    model_dir = params['model_dir']
    num_epochs = 20
    batch_size = 32
    model_params = params['model_params']
    print(model_params)

    if os.path.exists(model_dir): shutil.rmtree(model_dir)  # clean model_dir
    model_fn = make_model_fn(DCN_arch_fn)
    DCN = tf.estimator.Estimator(model_fn=model_fn, model_dir=model_dir, params=model_params, config=config)

    DCN.train(lambda: input_fn(ds_obj.file_tr, batch_size, num_epochs, True))
    print('eval in tr dataset')
    DCN.evaluate(lambda: input_fn(ds_obj.file_tr, batch_size, 1))
    print('eval in va dataset')
    DCN.evaluate(lambda: input_fn(ds_obj.file_va, batch_size, 1))

    """
    eval in tr dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7748605, auc = 0.7500452, global_step = 56227, loss = 0.49158287
    eval in va dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.77625024, auc = 0.7450472, global_step = 56227, loss = 0.49128637
    """
Пример #4
0
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)

    params = fm_default_params()
    config = estimator_default_config()

    ds_obj = params['ds_obj']
    model_dir = params['model_dir']
    num_epochs = 20
    batch_size = 32
    model_params = params['model_params']
    print(model_params)

    if os.path.exists(model_dir): shutil.rmtree(model_dir)  # clean model_dir
    model_fn = make_model_fn(fm_arch_fn)
    FM = tf.estimator.Estimator(model_fn=model_fn,
                                model_dir=model_dir,
                                params=model_params,
                                config=config)

    FM.train(lambda: input_fn(ds_obj.file_tr, batch_size, num_epochs, True))
    print('eval in tr dataset')
    FM.evaluate(lambda: input_fn(ds_obj.file_tr, batch_size, 1))
    print('eval in va dataset')
    FM.evaluate(lambda: input_fn(ds_obj.file_va, batch_size, 1))
    """
    eval in tr dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7939908, auc = 0.77037174, global_step = 56227, loss = 0.4618437
    eval in va dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7894003, auc = 0.752848, global_step = 56227, loss = 0.47008416
Пример #5
0
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)

    params = deepFM_default_params()
    config = estimator_default_config()

    ds_obj = params['ds_obj']
    model_dir = params['model_dir']
    num_epochs = 20
    batch_size = 32
    model_params = params['model_params']
    print(model_params)

    if os.path.exists(model_dir): shutil.rmtree(model_dir)  # clean model_dir
    model_fn = make_model_fn(deepFM_arch_fn)
    deepFM = tf.estimator.Estimator(model_fn=model_fn,
                                    model_dir=model_dir,
                                    params=model_params,
                                    config=config)

    deepFM.train(
        lambda: input_fn(ds_obj.file_tr, batch_size, num_epochs, True))
    print('eval in tr dataset')
    deepFM.evaluate(lambda: input_fn(ds_obj.file_tr, batch_size, 1))
    print('eval in va dataset')
    deepFM.evaluate(lambda: input_fn(ds_obj.file_va, batch_size, 1))
    """
    eval in tr dataset
    INFO:tensorflow:Saving dict for global step 56227: accuracy = 0.7947467, auc = 0.7710146, global_step = 56227, loss = 0.46117908
    eval in va dataset