teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

2020/01/14 00:04

投稿

masa.taka
masa.taka

スコア22

title CHANGED
File without changes
body CHANGED
@@ -8,9 +8,6 @@
8
8
 
9
9
  ```ここに言語を入力
10
10
  import pandas as pd
11
- sample_submission = pd.read_csv("../input/nlp-getting-started/sample_submission.csv")
12
- test = pd.read_csv("../input/nlp-getting-started/test.csv")
13
- train = pd.read_csv("../input/nlp-getting-started/train.csv")
14
11
  df=train
15
12
 
16
13
  from sklearn.preprocessing import LabelEncoder

2

修正

2020/01/14 00:04

投稿

masa.taka
masa.taka

スコア22

title CHANGED
File without changes
body CHANGED
@@ -46,5 +46,111 @@
46
46
  gscv.best_params_
47
47
  ```
48
48
  ```ここに言語を入力
49
+ ---------------------------------------------------------------------------
50
+ ValueError Traceback (most recent call last)
51
+ <ipython-input-10-e418a6eefe52> in <module>
52
+ 14 scoring="accuracy",cv=3
53
+ 15 )
54
+ ---> 16 gscv.fit(X_train,y_train)
55
+ 17 gscv.best_params_
56
+
57
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in fit(self, X, y, groups, **fit_params)
58
+ 686 return results
59
+ 687
60
+ --> 688 self._run_search(evaluate_candidates)
61
+ 689
62
+ 690 # For multi-metric evaluation, store the best_index_, best_params_ and
63
+
64
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in _run_search(self, evaluate_candidates)
65
+ 1147 def _run_search(self, evaluate_candidates):
66
+ 1148 """Search all candidates in param_grid"""
67
+ -> 1149 evaluate_candidates(ParameterGrid(self.param_grid))
68
+ 1150
69
+ 1151
70
+
71
+ /opt/conda/lib/python3.6/site-packages/sklearn/model_selection/_search.py in evaluate_candidates(candidate_params)
72
+ 665 for parameters, (train, test)
73
+ 666 in product(candidate_params,
74
+ --> 667 cv.split(X, y, groups)))
75
+ 668
76
+ 669 if len(out) < 1:
77
+
78
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in __call__(self, iterable)
79
+ 1001 # remaining jobs.
80
+ 1002 self._iterating = False
81
+ -> 1003 if self.dispatch_one_batch(iterator):
82
+ 1004 self._iterating = self._original_iterator is not None
83
+ 1005
84
+
85
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in dispatch_one_batch(self, iterator)
86
+ 832 return False
87
+ 833 else:
88
+ --> 834 self._dispatch(tasks)
89
+ 835 return True
90
+ 836
91
+
92
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in _dispatch(self, batch)
93
+ 751 with self._lock:
94
+ 752 job_idx = len(self._jobs)
95
+ --> 753 job = self._backend.apply_async(batch, callback=cb)
96
+ 754 # A job can complete so quickly than its callback is
97
+ 755 # called before we get here, causing self._jobs to
98
+
99
+ /opt/conda/lib/python3.6/site-packages/joblib/_parallel_backends.py in apply_async(self, func, callback)
100
+ 199 def apply_async(self, func, callback=None):
101
+ 200 """Schedule a func to be run"""
102
+ --> 201 result = ImmediateResult(func)
103
+ 202 if callback:
104
+ 203 callback(result)
105
+
106
+ /opt/conda/lib/python3.6/site-packages/joblib/_parallel_backends.py in __init__(self, batch)
107
+ 580 # Don't delay the application, to avoid keeping the input
108
+ 581 # arguments in memory
109
+ --> 582 self.results = batch()
110
+ 583
111
+ 584 def get(self):
112
+
113
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in __call__(self)
114
+ 254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
115
+ 255 return [func(*args, **kwargs)
116
+ --> 256 for func, args, kwargs in self.items]
117
+ 257
118
+ 258 def __len__(self):
119
+
120
+ /opt/conda/lib/python3.6/site-packages/joblib/parallel.py in <listcomp>(.0)
121
+ 254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
122
+ 255 return [func(*args, **kwargs)
123
+ --> 256 for func, args, kwargs in self.items]
124
+ 257
125
+ 258 def __len__(self):
126
+
127
+ /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)
128
+ 514 estimator.fit(X_train, **fit_params)
129
+ 515 else:
130
+ --> 516 estimator.fit(X_train, y_train, **fit_params)
131
+ 517
132
+ 518 except Exception as e:
133
+
134
+ /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)
135
+ 724 else:
136
+ 725 train_dmatrix = DMatrix(X, label=training_labels,
137
+ --> 726 missing=self.missing, nthread=self.n_jobs)
138
+ 727
139
+ 728 self._Booster = train(xgb_options, train_dmatrix, self.get_num_boosting_rounds(),
140
+
141
+ /opt/conda/lib/python3.6/site-packages/xgboost/core.py in __init__(self, data, label, missing, weight, silent, feature_names, feature_types, nthread)
142
+ 402 self._init_from_csc(data)
143
+ 403 elif isinstance(data, np.ndarray):
144
+ --> 404 self._init_from_npy2d(data, missing, nthread)
145
+ 405 elif isinstance(data, DataTable):
146
+ 406 self._init_from_dt(data, nthread)
147
+
148
+ /opt/conda/lib/python3.6/site-packages/xgboost/core.py in _init_from_npy2d(self, mat, missing, nthread)
149
+ 476 # we try to avoid data copies if possible (reshape returns a view when possible
150
+ 477 # and we explicitly tell np.array to try and avoid copying)
151
+ --> 478 data = np.array(mat.reshape(mat.size), copy=False, dtype=np.float32)
152
+ 479 handle = ctypes.c_void_p()
153
+ 480 missing = missing if missing is not None else np.nan
154
+
49
155
  ValueError: setting an array element with a sequence.
50
156
  ```

1

修正

2020/01/13 03:56

投稿

masa.taka
masa.taka

スコア22

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,3 @@
1
- 自然言語処理に取り組んでおります。
2
-
3
1
  以下のコードを書いておりますが、
4
2
  最後の「# GBDTモデルのパラメータ探索」以降のコード入力追加で、
5
3
  以下のようなエラー(setting an array element with a sequence.)が出ます。