質問編集履歴

4

2020/03/16 06:55

投稿

taka0606
taka0606

スコア9

test CHANGED
@@ -1 +1 @@
1
- 不均衡データを3つのクラスに分類し、グリッドサーチをしたいのですが 上手くいきません。
1
+ 不均衡データを3つのクラスに分類し、グリッドサーチをしたいのですが 上手くいきません。
test CHANGED
File without changes

3

2020/03/16 06:55

投稿

taka0606
taka0606

スコア9

test CHANGED
File without changes
test CHANGED
File without changes

2

2020/03/16 06:34

投稿

taka0606
taka0606

スコア9

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- 不均衡データを3つのクラスに分類し、グリッドサーチをしたいのですが
7
+ 不均衡データを3つのクラスに分類し、グリッドサーチをしたいのですが
8
8
 
9
9
  上手くいきません。
10
10
 

1

誤字とエラーメッセージの追加

2020/03/16 06:34

投稿

taka0606
taka0606

スコア9

test CHANGED
File without changes
test CHANGED
@@ -10,10 +10,6 @@
10
10
 
11
11
 
12
12
 
13
- (例)PHP(CakePHP)で●●なシステムを作っています。
14
-
15
- ■■な機能を実装中に以下のエラーメッセージが発生しました。
16
-
17
13
 
18
14
 
19
15
  ### 発生している問題・エラーメッセージ
@@ -22,6 +18,190 @@
22
18
 
23
19
  ```
24
20
 
21
+ ValueError Traceback (most recent call last)
22
+
23
+ <ipython-input-15-32a008acd626> in <module>
24
+
25
+ 41 grid_search = GridSearchCV(LinearSVC(class_weight="balanced"), param_grid, cv = 4)
26
+
27
+ 42
28
+
29
+ ---> 43 grid_search.fit(X_train_std, y_train)
30
+
31
+ 44
32
+
33
+ 45 # 結果
34
+
35
+
36
+
37
+ ~\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in fit(self, X, y, groups, **fit_params)
38
+
39
+ 686 return results
40
+
41
+ 687
42
+
43
+ --> 688 self._run_search(evaluate_candidates)
44
+
45
+ 689
46
+
47
+ 690 # For multi-metric evaluation, store the best_index_, best_params_ and
48
+
49
+
50
+
51
+ ~\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in _run_search(self, evaluate_candidates)
52
+
53
+ 1147 def _run_search(self, evaluate_candidates):
54
+
55
+ 1148 """Search all candidates in param_grid"""
56
+
57
+ -> 1149 evaluate_candidates(ParameterGrid(self.param_grid))
58
+
59
+ 1150
60
+
61
+ 1151
62
+
63
+
64
+
65
+ ~\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in evaluate_candidates(candidate_params)
66
+
67
+ 665 for parameters, (train, test)
68
+
69
+ 666 in product(candidate_params,
70
+
71
+ --> 667 cv.split(X, y, groups)))
72
+
73
+ 668
74
+
75
+ 669 if len(out) < 1:
76
+
77
+
78
+
79
+ ~\Anaconda3\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
80
+
81
+ 919 # remaining jobs.
82
+
83
+ 920 self._iterating = False
84
+
85
+ --> 921 if self.dispatch_one_batch(iterator):
86
+
87
+ 922 self._iterating = self._original_iterator is not None
88
+
89
+ 923
90
+
91
+
92
+
93
+ ~\Anaconda3\lib\site-packages\joblib\parallel.py in dispatch_one_batch(self, iterator)
94
+
95
+ 757 return False
96
+
97
+ 758 else:
98
+
99
+ --> 759 self._dispatch(tasks)
100
+
101
+ 760 return True
102
+
103
+ 761
104
+
105
+
106
+
107
+ ~\Anaconda3\lib\site-packages\joblib\parallel.py in _dispatch(self, batch)
108
+
109
+ 714 with self._lock:
110
+
111
+ 715 job_idx = len(self._jobs)
112
+
113
+ --> 716 job = self._backend.apply_async(batch, callback=cb)
114
+
115
+ 717 # A job can complete so quickly than its callback is
116
+
117
+ 718 # called before we get here, causing self._jobs to
118
+
119
+
120
+
121
+ ~\Anaconda3\lib\site-packages\joblib\_parallel_backends.py in apply_async(self, func, callback)
122
+
123
+ 180 def apply_async(self, func, callback=None):
124
+
125
+ 181 """Schedule a func to be run"""
126
+
127
+ --> 182 result = ImmediateResult(func)
128
+
129
+ 183 if callback:
130
+
131
+ 184 callback(result)
132
+
133
+
134
+
135
+ ~\Anaconda3\lib\site-packages\joblib\_parallel_backends.py in __init__(self, batch)
136
+
137
+ 547 # Don't delay the application, to avoid keeping the input
138
+
139
+ 548 # arguments in memory
140
+
141
+ --> 549 self.results = batch()
142
+
143
+ 550
144
+
145
+ 551 def get(self):
146
+
147
+
148
+
149
+ ~\Anaconda3\lib\site-packages\joblib\parallel.py in __call__(self)
150
+
151
+ 223 with parallel_backend(self._backend, n_jobs=self._n_jobs):
152
+
153
+ 224 return [func(*args, **kwargs)
154
+
155
+ --> 225 for func, args, kwargs in self.items]
156
+
157
+ 226
158
+
159
+ 227 def __len__(self):
160
+
161
+
162
+
163
+ ~\Anaconda3\lib\site-packages\joblib\parallel.py in <listcomp>(.0)
164
+
165
+ 223 with parallel_backend(self._backend, n_jobs=self._n_jobs):
166
+
167
+ 224 return [func(*args, **kwargs)
168
+
169
+ --> 225 for func, args, kwargs in self.items]
170
+
171
+ 226
172
+
173
+ 227 def __len__(self):
174
+
175
+
176
+
177
+ ~\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, return_estimator, error_score)
178
+
179
+ 501 train_scores = {}
180
+
181
+ 502 if parameters is not None:
182
+
183
+ --> 503 estimator.set_params(**parameters)
184
+
185
+ 504
186
+
187
+ 505 start_time = time.time()
188
+
189
+
190
+
191
+ ~\Anaconda3\lib\site-packages\sklearn\base.py in set_params(self, **params)
192
+
193
+ 222 'Check the list of available parameters '
194
+
195
+ 223 'with `estimator.get_params().keys()`.' %
196
+
197
+ --> 224 (key, self))
198
+
199
+ 225
200
+
201
+ 226 if delim:
202
+
203
+
204
+
25
205
  ValueError: Invalid parameter gamma for estimator LinearSVC(C=0.001, class_weight='balanced', dual=True, fit_intercept=True,
26
206
 
27
207
  intercept_scaling=1, loss='squared_hinge', max_iter=1000,
@@ -34,8 +214,6 @@
34
214
 
35
215
 
36
216
 
37
-
38
-
39
217
  ```Python
40
218
 
41
219
  ソースコード