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

質問編集履歴

2

提出完了報告

2018/09/12 03:37

投稿

Yukiya025
Yukiya025

スコア86

title CHANGED
File without changes
body CHANGED
@@ -123,4 +123,8 @@
123
123
  min_samples_leaf=1, min_samples_split=2,
124
124
  min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1,
125
125
  oob_score=False, random_state=None, verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`.
126
- ```
126
+ ```
127
+
128
+ # kaggleのTitanic課題提出まで漕ぎ着けました!
129
+ [hayataka2049](https://teratail.com/users/hayataka2049) さまのおかげです(*≧∀≦)
130
+ ![Titanic Submit](f7627fce2914e4a7fe863a1952635704.png)

1

`classifier__`削除後のエラー文追加

2018/09/12 03:37

投稿

Yukiya025
Yukiya025

スコア86

title CHANGED
File without changes
body CHANGED
@@ -8,9 +8,9 @@
8
8
  - Windows7
9
9
  # 躓いた箇所とエラー文
10
10
  grid_param内の書き方がよくないのだと推測しています。もともとのTitanic課題kernelには`classifier__` はついていなかったのですが、[stackoverflow](https://stackoverflow.com/questions/34889110/random-forest-with-gridsearchcv-error-on-param-grid)を見て`classifier__`をつけることにしました。
11
+ **↑`classifier__`削除済**
11
12
 
12
- かし、`BaggingClassifier`に関して、どう修正すべきなわかりせん(>_<)
13
+ 削除はたもの、ExtraTreesClassifierでエラー出ていす。
13
- エラー文からは`BaggingClassifier`と`estimator.get_params().keys()`が関係しているように読めるのですが。。。
14
14
  ```python
15
15
  #WARNING: Running is very computational intensive and time expensive.
16
16
  grid_n_estimator = [10, 50, 100, 300]
@@ -31,68 +31,68 @@
31
31
 
32
32
  [{
33
33
  'n_estimators': grid_n_estimator,
34
- 'classifier__max_samples': grid_ratio,
34
+ 'max_samples': grid_ratio,
35
35
  'random_state': grid_seed
36
36
  }],
37
37
 
38
38
  [{
39
39
  'n_estimators': grid_n_estimator,
40
- 'classifier__criterion': grid_criterion,
40
+ 'criterion': grid_criterion,
41
- 'classifier__max_depth': grid_max_depth,
41
+ 'max_depth': grid_max_depth,
42
42
  'random state': grid_seed
43
43
  }],
44
44
 
45
45
  [{
46
46
  'learning_rate': [.05],
47
47
  'n_estimators': [300],
48
- 'classifier__max_depth': grid_max_depth,
48
+ 'max_depth': grid_max_depth,
49
49
  'random_state': grid_seed
50
50
  }],
51
51
 
52
52
  [{
53
53
  'n_estimators': grid_n_estimator,
54
- 'classifier__criterion': grid_criterion,
54
+ 'criterion': grid_criterion,
55
- 'classifier__max_depth': grid_max_depth,
55
+ 'max_depth': grid_max_depth,
56
- 'classifier__oob_score': [True],
56
+ 'oob_score': [True],
57
57
  'random_state': grid_seed
58
58
  }],
59
59
 
60
60
  [{
61
- 'classifier__max_iter_predict': grid_n_estimator,
61
+ 'max_iter_predict': grid_n_estimator,
62
62
  'random_state': grid_seed
63
63
  }],
64
64
 
65
65
  [{
66
- 'classifier__fit_intercept': grid_bool,
66
+ 'fit_intercept': grid_bool,
67
- 'classifier__solver': ['newton-cg', 'lbfgs', 'liblinear', 'sag', 'saga'],
67
+ 'solver': ['newton-cg', 'lbfgs', 'liblinear', 'sag', 'saga'],
68
68
  'random_state': grid_seed
69
69
  }],
70
70
 
71
71
  [{
72
- 'classifier__alpha': grid_ratio,
72
+ 'alpha': grid_ratio,
73
73
  }],
74
74
 
75
75
  [{}],
76
76
 
77
77
  [{
78
- 'classifier__n_neighbors': [1,2,3,4,5,6,7],
78
+ 'n_neighbors': [1,2,3,4,5,6,7],
79
- 'classifier__weights': ['uniform', 'distance'],
79
+ 'weights': ['uniform', 'distance'],
80
80
  'algorithm': ['auto', 'ball_tree', 'kd_tree', 'brute']
81
81
  }],
82
82
 
83
83
  [{
84
- 'classifier__C': [1,2,3,4,5],
84
+ 'C': [1,2,3,4,5],
85
- 'classifier__gamma': grid_ratio,
85
+ 'gamma': grid_ratio,
86
- 'classifier__decision_function_shape': ['ovo', 'ovr'],
86
+ 'decision_function_shape': ['ovo', 'ovr'],
87
- 'classifier__probability': [True],
87
+ 'probability': [True],
88
88
  'random_state': grid_seed
89
89
  }],
90
90
 
91
91
  [{
92
92
  'learning_rate': grid_learn,
93
- 'classifier__max_depth': [1,2,4,6,8,10],
93
+ 'max_depth': [1,2,4,6,8,10],
94
94
  'n_estimators': grid_n_estimator,
95
- 'classifier__seed': grid_seed
95
+ 'seed': grid_seed
96
96
  }]
97
97
  ]
98
98
 
@@ -114,11 +114,13 @@
114
114
  print('-' *10)
115
115
  ```
116
116
 
117
- **エラー文**
117
+ **`classifier__`削除後のエラー文**
118
118
 
119
119
  ```
120
- ValueError: Invalid parameter classifier for estimator BaggingClassifier(base_estimator=None, bootstrap=True,
120
+ ValueError: Invalid parameter random state for estimator ExtraTreesClassifier(bootstrap=False, class_weight=None, criterion='gini',
121
- bootstrap_features=False, max_features=1.0, max_samples=0.25,
121
+ max_depth=2, max_features='auto', max_leaf_nodes=None,
122
+ min_impurity_decrease=0.0, min_impurity_split=None,
123
+ min_samples_leaf=1, min_samples_split=2,
122
- n_estimators=300, n_jobs=1, oob_score=False, random_state=0,
124
+ min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1,
123
- verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`.
125
+ oob_score=False, random_state=None, verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`.
124
126
  ```