-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.py
92 lines (73 loc) · 2.39 KB
/
config.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
92
# -*- coding: utf-8 --*--
# @Author: Zessay
# @time: 2019.05.09 10:01
# @File: config.py
# @Software: PyCharm
class DefaultConfig(dict):
def __init__(self):
# 用于存储模型、数据、停止词以及结果的路径
self['data_dir'] = 'data'
self['data_dict'] = 'data/nerdict'
self['data_gen'] = 'data/gen'
## 用于保存模型和结果的位置
self['model_word'] = 'models/word'
self['model_train'] = 'models/machine'
self['result_dir'] = 'result'
## 停止词相关的路径
self['stopwords_dir'] = 'stopwords'
self['post_sw'] = 'post_stopwords.txt'
self['simple_sw'] = 'simple_stopwords.txt'
self['special_sw'] = 'special_stopwords.txt'
## 训练集和测试集的文件名
self['train_file'] = 'coreEntityEmotion_train.txt'
self['test_file'] = 'coreEntityEmotion_test_stage2.txt'
# 3个模型训练的参数
self['lgb_params'] = {
'boosting_type': 'gbdt',
'objective': 'binary',
'metric': 'xentropy',
'num_leaves': 63,
'learning_rate': 0.01,
'feature_fraction': 0.8,
'bagging_fraction': 0.8,
'bagging_seed': 0,
'bagging_freq': 1,
'verbose': 1,
'reg_alpha': 1,
'reg_lambda': 2,
'seed': 2019,
# 设置GPU
'device': 'gpu',
'gpu_platform_id': 1,
'gpu_device_id': 0
}
self['xgb_params'] = {
'booster': 'gbtree',
'objective': 'binary:logistic',
'eval_metric': 'logloss',
'learning_rate': 0.0894,
'max_depth': 9,
'max_leaves': 20,
'lambda': 2,
'alpha': 1,
'subsample': 0.8,
'colsample_bytree': 0.8,
'silent': 1,
'seed': 2019,
# 使用gpu
'gpu_id': 0,
'tree_method': 'gpu_hist'
}
self['cat_params'] = {
'loss_function': 'Logloss',
'eval_metric': 'F1',
'learning_rate': 0.05,
'max_depth': 5,
'max_leaves_count': 63,
'reg_lambda': 2,
'verbose': 1,
'random_seed': 2019,
# 使用GPU
'od_type': 'Iter',
'task_type': 'GPU'
}