質問編集履歴

2

コードとエラーコードを追加

2020/08/17 21:13

投稿

taitan38
taitan38

スコア0

test CHANGED
File without changes
test CHANGED
@@ -12,13 +12,45 @@
12
12
 
13
13
  ### **__発生している問題・エラーメッセージ__**
14
14
 
15
+ ---------------------------------------------------------------------------
16
+
17
+ TypeError Traceback (most recent call last)
18
+
19
+ <ipython-input-126-ccfa323308ad> in <module>
20
+
21
+ 17
22
+
23
+ 18 num_round = 10
24
+
25
+ **---> 19 bst = xgb.train(param_grid, dtrain, num_round)**
26
+
27
+ 20
28
+
29
+ 21
30
+
31
+
32
+
33
+ ~\Anaconda3\lib\site-packages\xgboost\training.py in train(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks, learning_rates)
34
+
35
+ 214 evals=evals,
36
+
37
+ 215 obj=obj, feval=feval,
38
+
39
+ **--> 216 xgb_model=xgb_model, callbacks=callbacks)**
40
+
41
+ 217
42
+
43
+ 218
44
+
45
+
46
+
15
47
  ~\Anaconda3\lib\site-packages\xgboost\training.py in _train_internal(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks)
16
48
 
17
49
  46 nboost //= num_parallel_tree
18
50
 
19
51
  47 if 'num_class' in _params:
20
52
 
21
- ---> 48 nboost //= _params['num_class']
53
+ **---> 48 nboost //= _params['num_class']**
22
54
 
23
55
  49
24
56
 
@@ -32,16 +64,32 @@
32
64
 
33
65
  ### **該当のソースコード**
34
66
 
67
+ dtrain = xgb.DMatrix(x_train, label=y_train)
68
+
69
+ dtest = xgb.DMatrix(x_test, label=y_test)
70
+
71
+
72
+
73
+
74
+
35
75
  param_grid = {
36
76
 
37
- 'max_depth': [0,1,3],
77
+ 'max_depth': [0,1,3],
38
78
 
39
79
  'gamma':[0,0.2,0.03],
40
80
 
41
81
  'booster':['gbtree'],
42
82
 
43
- 'objective':['multi:softmax'],
83
+ 'objective':['multi:softmax'],
44
84
 
45
85
  'num_class':[50],
46
86
 
47
87
  }
88
+
89
+
90
+
91
+ num_round = 10
92
+
93
+ bst = xgb.train(param_grid, dtrain, num_round)
94
+
95
+ xgb.plot_importance(bst)

1

表題の変更

2020/08/17 21:13

投稿

taitan38
taitan38

スコア0

test CHANGED
@@ -1 +1 @@
1
- XGBoost gredサーチのエラー回避
1
+ XGBoost gridサーチのエラー回避
test CHANGED
File without changes