|
16 | 16 | regression_params = {'objective': 'regression', 'verbosity': -1} |
17 | 17 | regression_train = lgb.Dataset(X_train, label=y_train) |
18 | 18 | eval_hist = lgb.cv(regression_params, regression_train, shuffle=False, stratified=False) |
19 | | -print(eval_hist['l2-mean'][0]) |
20 | | -print(eval_hist['l2-mean'][-1]) |
21 | | -print(eval_hist['l2-stdv'][0]) |
22 | | -print(eval_hist['l2-stdv'][-1]) |
| 19 | +print(eval_hist['valid l2-mean'][0]) |
| 20 | +print(eval_hist['valid l2-mean'][-1]) |
| 21 | +print(eval_hist['valid l2-stdv'][0]) |
| 22 | +print(eval_hist['valid l2-stdv'][-1]) |
23 | 23 |
|
24 | 24 | print() |
25 | 25 | print('test_binary') |
26 | 26 |
|
27 | 27 | binary_params = {'objective': 'binary', 'verbosity': -1} |
28 | 28 | binary_train = lgb.Dataset(X_train, label=y_train.replace(2, 1)) |
29 | 29 | eval_hist = lgb.cv(binary_params, binary_train, shuffle=False, stratified=False) |
30 | | -print(eval_hist['binary_logloss-mean'][0]) |
31 | | -print(eval_hist['binary_logloss-mean'][-1]) |
32 | | -print(eval_hist['binary_logloss-stdv'][0]) |
33 | | -print(eval_hist['binary_logloss-stdv'][-1]) |
| 30 | +print(eval_hist['valid binary_logloss-mean'][0]) |
| 31 | +print(eval_hist['valid binary_logloss-mean'][-1]) |
| 32 | +print(eval_hist['valid binary_logloss-stdv'][0]) |
| 33 | +print(eval_hist['valid binary_logloss-stdv'][-1]) |
34 | 34 |
|
35 | 35 | print() |
36 | 36 | print('test_multiclass') |
37 | 37 |
|
38 | 38 | multiclass_params = {'objective': 'multiclass', 'num_class': 3, 'verbosity': -1} |
39 | 39 | multiclass_train = lgb.Dataset(X_train, label=y_train) |
40 | 40 | eval_hist = lgb.cv(multiclass_params, multiclass_train, shuffle=False, stratified=False) |
41 | | -print(eval_hist['multi_logloss-mean'][0]) |
42 | | -print(eval_hist['multi_logloss-mean'][-1]) |
43 | | -print(eval_hist['multi_logloss-stdv'][0]) |
44 | | -print(eval_hist['multi_logloss-stdv'][-1]) |
| 41 | +print(eval_hist['valid multi_logloss-mean'][0]) |
| 42 | +print(eval_hist['valid multi_logloss-mean'][-1]) |
| 43 | +print(eval_hist['valid multi_logloss-stdv'][0]) |
| 44 | +print(eval_hist['valid multi_logloss-stdv'][-1]) |
45 | 45 |
|
46 | 46 | print('') |
47 | 47 | print('test_early_stopping_early') |
48 | 48 |
|
49 | | -eval_hist = lgb.cv(regression_params, regression_train, shuffle=False, stratified=False, verbose_eval=True, early_stopping_rounds=5) |
50 | | -print(len(eval_hist['l2-mean'])) |
| 49 | +regression_params = {'objective': 'regression', 'verbosity': 1, 'early_stopping_round': 5} |
| 50 | +eval_hist = lgb.cv(regression_params, regression_train, shuffle=False, stratified=False) |
| 51 | +print(len(eval_hist['valid l2-mean'])) |
51 | 52 |
|
52 | 53 | print('') |
53 | 54 | print('test_early_stopping_not_early') |
54 | 55 |
|
55 | | -eval_hist = lgb.cv(regression_params, regression_train, shuffle=False, stratified=False, verbose_eval=True, early_stopping_rounds=500) |
56 | | -print(len(eval_hist['l2-mean'])) |
| 56 | +regression_params = {'objective': 'regression', 'verbosity': 1, 'early_stopping_round': 500} |
| 57 | +eval_hist = lgb.cv(regression_params, regression_train, shuffle=False, stratified=False) |
| 58 | +print(len(eval_hist['valid l2-mean'])) |
| 59 | + |
57 | 60 |
|
0 commit comments