質問編集履歴

3

2020/01/14 00:04

投稿

masa.taka
masa.taka

スコア22

test CHANGED
File without changes
test CHANGED
@@ -18,12 +18,6 @@
18
18
 
19
19
  import pandas as pd
20
20
 
21
- sample_submission = pd.read_csv("../input/nlp-getting-started/sample_submission.csv")
22
-
23
- test = pd.read_csv("../input/nlp-getting-started/test.csv")
24
-
25
- train = pd.read_csv("../input/nlp-getting-started/train.csv")
26
-
27
21
  df=train
28
22
 
29
23
 

2

修正

2020/01/14 00:04

投稿

masa.taka
masa.taka

スコア22

test CHANGED
File without changes
test CHANGED
@@ -94,6 +94,218 @@
94
94
 
95
95
  ```ここに言語を入力
96
96
 
97
+ ---------------------------------------------------------------------------
98
+
99
+ ValueError Traceback (most recent call last)
100
+
101
+ <ipython-input-10-e418a6eefe52> in <module>
102
+
103
+ 14 scoring="accuracy",cv=3
104
+
105
+ 15 )
106
+
107
+ ---> 16 gscv.fit(X_train,y_train)
108
+
109
+ 17 gscv.best_params_
110
+
111
+
112
+
113
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in fit(self, X, y, groups, **fit_params)
114
+
115
+ 686 return results
116
+
117
+ 687
118
+
119
+ --> 688 self._run_search(evaluate_candidates)
120
+
121
+ 689
122
+
123
+ 690 # For multi-metric evaluation, store the best_index_, best_params_ and
124
+
125
+
126
+
127
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in _run_search(self, evaluate_candidates)
128
+
129
+ 1147 def _run_search(self, evaluate_candidates):
130
+
131
+ 1148 """Search all candidates in param_grid"""
132
+
133
+ -> 1149 evaluate_candidates(ParameterGrid(self.param_grid))
134
+
135
+ 1150
136
+
137
+ 1151
138
+
139
+
140
+
141
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in evaluate_candidates(candidate_params)
142
+
143
+ 665 for parameters, (train, test)
144
+
145
+ 666 in product(candidate_params,
146
+
147
+ --> 667 cv.split(X, y, groups)))
148
+
149
+ 668
150
+
151
+ 669 if len(out) < 1:
152
+
153
+
154
+
155
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in __call__(self, iterable)
156
+
157
+ 1001 # remaining jobs.
158
+
159
+ 1002 self._iterating = False
160
+
161
+ -> 1003 if self.dispatch_one_batch(iterator):
162
+
163
+ 1004 self._iterating = self._original_iterator is not None
164
+
165
+ 1005
166
+
167
+
168
+
169
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in dispatch_one_batch(self, iterator)
170
+
171
+ 832 return False
172
+
173
+ 833 else:
174
+
175
+ --> 834 self._dispatch(tasks)
176
+
177
+ 835 return True
178
+
179
+ 836
180
+
181
+
182
+
183
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in _dispatch(self, batch)
184
+
185
+ 751 with self._lock:
186
+
187
+ 752 job_idx = len(self._jobs)
188
+
189
+ --> 753 job = self._backend.apply_async(batch, callback=cb)
190
+
191
+ 754 # A job can complete so quickly than its callback is
192
+
193
+ 755 # called before we get here, causing self._jobs to
194
+
195
+
196
+
197
+ /opt/conda/lib/python3.6/site-packages/joblib/_parallel_backends.py in apply_async(self, func, callback)
198
+
199
+ 199 def apply_async(self, func, callback=None):
200
+
201
+ 200 """Schedule a func to be run"""
202
+
203
+ --> 201 result = ImmediateResult(func)
204
+
205
+ 202 if callback:
206
+
207
+ 203 callback(result)
208
+
209
+
210
+
211
+ /opt/conda/lib/python3.6/site-packages/joblib/_parallel_backends.py in __init__(self, batch)
212
+
213
+ 580 # Don't delay the application, to avoid keeping the input
214
+
215
+ 581 # arguments in memory
216
+
217
+ --> 582 self.results = batch()
218
+
219
+ 583
220
+
221
+ 584 def get(self):
222
+
223
+
224
+
225
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in __call__(self)
226
+
227
+ 254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
228
+
229
+ 255 return [func(*args, **kwargs)
230
+
231
+ --> 256 for func, args, kwargs in self.items]
232
+
233
+ 257
234
+
235
+ 258 def __len__(self):
236
+
237
+
238
+
239
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in <listcomp>(.0)
240
+
241
+ 254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
242
+
243
+ 255 return [func(*args, **kwargs)
244
+
245
+ --> 256 for func, args, kwargs in self.items]
246
+
247
+ 257
248
+
249
+ 258 def __len__(self):
250
+
251
+
252
+
253
+ /opt/conda/lib/python3.6/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)
254
+
255
+ 514 estimator.fit(X_train, **fit_params)
256
+
257
+ 515 else:
258
+
259
+ --> 516 estimator.fit(X_train, y_train, **fit_params)
260
+
261
+ 517
262
+
263
+ 518 except Exception as e:
264
+
265
+
266
+
267
+ /opt/conda/lib/python3.6/site-packages/xgboost/sklearn.py in fit(self, X, y, sample_weight, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, callbacks)
268
+
269
+ 724 else:
270
+
271
+ 725 train_dmatrix = DMatrix(X, label=training_labels,
272
+
273
+ --> 726 missing=self.missing, nthread=self.n_jobs)
274
+
275
+ 727
276
+
277
+ 728 self._Booster = train(xgb_options, train_dmatrix, self.get_num_boosting_rounds(),
278
+
279
+
280
+
281
+ /opt/conda/lib/python3.6/site-packages/xgboost/core.py in __init__(self, data, label, missing, weight, silent, feature_names, feature_types, nthread)
282
+
283
+ 402 self._init_from_csc(data)
284
+
285
+ 403 elif isinstance(data, np.ndarray):
286
+
287
+ --> 404 self._init_from_npy2d(data, missing, nthread)
288
+
289
+ 405 elif isinstance(data, DataTable):
290
+
291
+ 406 self._init_from_dt(data, nthread)
292
+
293
+
294
+
295
+ /opt/conda/lib/python3.6/site-packages/xgboost/core.py in _init_from_npy2d(self, mat, missing, nthread)
296
+
297
+ 476 # we try to avoid data copies if possible (reshape returns a view when possible
298
+
299
+ 477 # and we explicitly tell np.array to try and avoid copying)
300
+
301
+ --> 478 data = np.array(mat.reshape(mat.size), copy=False, dtype=np.float32)
302
+
303
+ 479 handle = ctypes.c_void_p()
304
+
305
+ 480 missing = missing if missing is not None else np.nan
306
+
307
+
308
+
97
309
  ValueError: setting an array element with a sequence.
98
310
 
99
311
  ```

1

修正

2020/01/13 03:56

投稿

masa.taka
masa.taka

スコア22

test CHANGED
File without changes
test CHANGED
@@ -1,7 +1,3 @@
1
- 自然言語処理に取り組んでおります。
2
-
3
-
4
-
5
1
  以下のコードを書いておりますが、
6
2
 
7
3
  最後の「# GBDTモデルのパラメータ探索」以降のコード入力追加で、