質問編集履歴

4

不要箇所削除

2020/04/12 15:42

投稿

kouji_39
kouji_39

スコア164

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  ValueError Traceback (most recent call last)
34
34
 
35
- <ipython-input-35-243282289f03> in <module>()
35
+
36
36
 
37
37
  3
38
38
 

3

不要箇所削除

2020/04/12 15:42

投稿

kouji_39
kouji_39

スコア164

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  2 frames
46
46
 
47
- /usr/local/lib/python3.6/dist-packages/sklearn/model_selection/_split.py in _iter_indices(self, X, y, groups)
47
+
48
48
 
49
49
  1657 class_counts = np.bincount(y_indices)
50
50
 

2

エラーメッセージの追加

2020/04/12 15:32

投稿

kouji_39
kouji_39

スコア164

test CHANGED
File without changes
test CHANGED
@@ -28,6 +28,36 @@
28
28
 
29
29
  このデータ分割後に次のエラーとなります。
30
30
 
31
+ ---------------------------------------------------------------------------
32
+
33
+ ValueError Traceback (most recent call last)
34
+
35
+ <ipython-input-35-243282289f03> in <module>()
36
+
37
+ 3
38
+
39
+ 4 from sklearn.model_selection import train_test_split
40
+
41
+ ----> 5 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,stratify=binned_y)
42
+
43
+
44
+
45
+ 2 frames
46
+
47
+ /usr/local/lib/python3.6/dist-packages/sklearn/model_selection/_split.py in _iter_indices(self, X, y, groups)
48
+
49
+ 1657 class_counts = np.bincount(y_indices)
50
+
51
+ 1658 if np.min(class_counts) < 2:
52
+
53
+ -> 1659 raise ValueError("The least populated class in y has only 1"
54
+
55
+ 1660 " member, which is too few. The minimum"
56
+
57
+ 1661 " number of groups for any class cannot"
58
+
59
+
60
+
31
61
  ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2.
32
62
 
33
63
 

1

コードの記入方法

2020/04/12 14:00

投稿

kouji_39
kouji_39

スコア164

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,8 @@
1
1
  勾配部―スティング決定木のチューニングというアンサンブル学習で回帰予測を
2
2
 
3
3
  実施しました。
4
+
5
+ ```ここに言語を入力
4
6
 
5
7
  #Numpyの配列に変換
6
8
 
@@ -22,6 +24,8 @@
22
24
 
23
25
 
24
26
 
27
+ ```
28
+
25
29
  このデータ分割後に次のエラーとなります。
26
30
 
27
31
  ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2.