-
Notifications
You must be signed in to change notification settings - Fork 0
/
S5_LGB_main.py
91 lines (82 loc) · 2.98 KB
/
S5_LGB_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import warnings
warnings.simplefilter('ignore')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import gc,os,random
import time,datetime
from tqdm import tqdm
from sklearn.preprocessing import LabelEncoder
from utils import *
from model import *
root = args.root
seed = args.seed
df = pd.read_feather(f'{root}/all_feature.feather')
train_y = pd.read_csv(f'{root}/train_labels.csv')
train = df[:train_y.shape[0]]
train['target'] = train_y['target']
test = df[train_y.shape[0]:].reset_index(drop=True)
del df
print(train.shape,test.shape)
lgb_config = {
'lgb_params':{
'objective' : 'binary',
'metric' : 'binary_logloss',
'boosting': 'dart',
'max_depth' : -1,
'num_leaves' : 64,
'learning_rate' : 0.035,
'bagging_freq': 5,
'bagging_fraction' : 0.75,
'feature_fraction' : 0.05,
'min_data_in_leaf': 256,
'max_bin': 63,
'min_data_in_bin': 256,
# 'min_sum_heassian_in_leaf': 10,
'tree_learner': 'serial',
'boost_from_average': 'false',
'lambda_l1' : 0.1,
'lambda_l2' : 30,
'num_threads': 24,
'verbosity' : 1,
},
'feature_name':[],
'rounds':4500,
'early_stopping_rounds':100,
'verbose_eval':50,
'folds':5,
'seed':seed
}
lgb_config = {
'lgb_params':{
'objective' : 'binary',
'metric' : 'binary_logloss',
'boosting': 'dart',
'max_depth' : -1,
'num_leaves' : 64,
'learning_rate' : 0.035,
'bagging_freq': 5,
'bagging_fraction' : 0.75,
'feature_fraction' : 0.05,
'min_data_in_leaf': 256,
'max_bin': 63,
'min_data_in_bin': 256,
# 'min_sum_heassian_in_leaf': 10,
'tree_learner': 'serial',
'boost_from_average': 'false',
'lambda_l1' : 0.1,
'lambda_l2' : 30,
'num_threads': 24,
'verbosity' : 1,
},
'feature_name':[col for col in train.columns if col not in [id_name,label_name,'S_2'] and 'skew' not in col and 'kurt' not in col and 'sub_mean' not in col and 'div_mean' not in col],
'rounds':4500,
'early_stopping_rounds':100,
'verbose_eval':50,
'folds':5,
'seed':seed
}
lgb_config['feature_name'] = [col for col in train.columns if col not in [id_name,label_name,'S_2'] and 'target' not in col]
Lgb_train_and_predict(train,test,lgb_config,aug=None,run_id='LGB_with_manual_feature')
lgb_config['feature_name'] = [col for col in train.columns if col not in [id_name,label_name,'S_2']]
Lgb_train_and_predict(train,test,lgb_config,aug=None,run_id='LGB_with_manual_feature_and_series_oof')