コード例 #1
0
    k=8,
    hash_ids=int(2e5),
    batch_size=args.b,  # 1024
    optimizer="adam",
    learning_rate=0.001,
    num_display_steps=250,
    num_eval_steps=1000,
    epoch=1,
    metric='auc',
    activation=['relu', 'relu', 'relu'],
    cross_activation='identity',
    init_method='uniform',
    init_value=0.1,
    feature_nums=len(features),
    kfold=5)
utils.print_hparams(hparam)

# # Training model

# In[6]:

kfold = KFold(n_splits=hparam.kfold, shuffle=True, random_state=712)
for i, (train_index, dev_index) in enumerate(kfold.split(train)):
    print('Fold', i)

    model = ctrNet.build_model(hparam)
    model.train(train_data=(train.iloc[train_index][features],
                            train.iloc[train_index]['HasDetections']),
                dev_data=(train.iloc[dev_index][features],
                          train.iloc[dev_index]['HasDetections']))
    print("Training Done! Inference...")
コード例 #2
0
                                     k=8,
                                     hash_ids=int(2e5),
                                     batch_size=1024,
                                     optimizer="adam",
                                     learning_rate=0.001,
                                     num_display_steps=1000,
                                     num_eval_steps=1000,
                                     epoch=1,
                                     metric='auc',
                                     activation=['relu', 'relu', 'relu'],
                                     cross_activation='identity',
                                     init_method='uniform',
                                     init_value=0.1,
                                     feature_nums=train.shape[1],
                                     kfold=5)
misc_utils.print_hparams(hparam)
#========================================================================

#========================================================================
# Result Box
model_list = []
result_list = []
score_list = []
val_pred_list = []

oof_pred = np.zeros(train.shape[0])
y_test = np.zeros(x_test.shape[0])
#========================================================================

model_type = 'NN'