質問編集履歴

1

コードとエラーの詳細の追加

2019/11/15 04:28

投稿

hizuma
hizuma

スコア7

test CHANGED
File without changes
test CHANGED
@@ -2,11 +2,81 @@
2
2
 
3
3
 
4
4
 
5
- チュニング部分コードです。
5
+ エラは以下通りです。
6
6
 
7
- #ExtraTreesRegressor
7
+ ValueError: Invalid parameter n_estimaters for estimator ExtraTreesRegressor(bootstrap=False, criterion='mse', max_depth=None,
8
8
 
9
+ max_features=0.1, max_leaf_nodes=None, min_impurity_decrease=0.0,
10
+
11
+ min_impurity_split=None, min_samples_leaf=1, min_samples_split=2,
12
+
13
+ min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1,
14
+
15
+ oob_score=False, random_state=None, verbose=0, warm_start=False). Check the list of available parameters with `estimator.get_params().keys()`.
16
+
17
+
18
+
19
+
20
+
21
+ ```python
22
+
23
+ コード```
24
+
25
+ import numpy as np
26
+
27
+ import pandas as pd
28
+
29
+ from sklearn.model_selection import GridSearchCV
30
+
31
+ from sklearn.ensemble import ExtraTreesRegressor
32
+
33
+ from sklearn.metrics import r2_score
34
+
35
+ from sklearn.metrics import mean_squared_error
36
+
37
+ from sklearn.metrics import mean_absolute_error
38
+
39
+
40
+
41
+ sample_data = pd.read_csv('transformed_include_error_4.csv')
42
+
43
+ sample_data = sample_data.query('Error ==0')
44
+
45
+
46
+
47
+ sample_data = pd.read_csv('transformed_include_error_4.csv')
48
+
49
+ test_data = sample_data.query('Error ==0')
50
+
51
+
52
+
53
+ np.random.seed(seed=42)
54
+
55
+ indices = np.random.permutation(len(sample_data))
56
+
57
+ train_size = 140
58
+
59
+ train_idx, test_idx = indices[:train_size], indices[train_size:]
60
+
61
+
62
+
63
+ train_data = sample_data.iloc[train_idx]
64
+
65
+ test_data = test_data.iloc[test_idx]
66
+
67
+
68
+
69
+ y_train = train_data['Rate']
70
+
71
+ x_train = train_data.loc[:,["feature_1","feature_2","feature_3","feature_4"]]
72
+
73
+
74
+
9
- ############################
75
+ y_test = test_data['Rate']
76
+
77
+ x_test = test_data.loc[:,["feature_1","feature_2","feature_3","feature_4"]]
78
+
79
+
10
80
 
11
81
  params = {
12
82
 
@@ -32,12 +102,4 @@
32
102
 
33
103
  )
34
104
 
35
-
36
-
37
105
  clf.fit(x_train,y_train)
38
-
39
- ############################
40
-
41
- SVRではチューニングもテストデータの予測も行えたのでデータに間違いがあるとは思えません。
42
-
43
- ExtraTreesRegressorを初めて使うので根本的なミスなど原因が知りたいです。