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

回答編集履歴

2

d

2020/04/15 04:45

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -58,4 +58,8 @@
58
58
  y train test
59
59
  2 1.0 0.750623 0.249377 ← ほぼ 75:25 の割合になってる
60
60
  1 1.0 0.747475 0.252525 ← ほぼ 75:25 の割合になってる
61
- ```
61
+ ```
62
+
63
+ ----
64
+
65
+ 不明点があれば追記しますので、コメントしてください

1

2020/04/15 04:45

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # 層化抽出なし
24
24
  #############################
25
- train, test = train_test_split(y)
25
+ train, test = train_test_split(y) # 75]25 の割合で分割 (デフォルト)
26
26
  print("層化抽出なし")
27
27
  df = pd.DataFrame({"y": pd.value_counts(y), "train": pd.value_counts(train), "test": pd.value_counts(test)})
28
28
  print(df)
@@ -32,7 +32,7 @@
32
32
 
33
33
  # 層化抽出あり
34
34
  #############################
35
- train, test = train_test_split(y, stratify=y)
35
+ train, test = train_test_split(y, stratify=y) # 75]25 の割合で分割 (デフォルト)
36
36
  print("層化抽出あり")
37
37
 
38
38
  df = pd.DataFrame({"y": pd.value_counts(y), "train": pd.value_counts(train), "test": pd.value_counts(test)})
@@ -49,13 +49,13 @@
49
49
  2 401 307 94
50
50
  1 99 68 31
51
51
  y train test
52
- 2 1.0 0.765586 0.234414
52
+ 2 1.0 0.765586 0.234414 ← ほぼ 75:25 の割合になってる
53
- 1 1.0 0.686869 0.313131
53
+ 1 1.0 0.686869 0.313131 ← 75:25 の割合になってない
54
54
  層化抽出あり
55
55
  y train test
56
56
  2 401 301 100
57
57
  1 99 74 25
58
58
  y train test
59
- 2 1.0 0.750623 0.249377
59
+ 2 1.0 0.750623 0.249377 ← ほぼ 75:25 の割合になってる
60
- 1 1.0 0.747475 0.252525
60
+ 1 1.0 0.747475 0.252525 ← ほぼ 75:25 の割合になってる
61
61
  ```