質問編集履歴
2
少し変更しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,11 +30,11 @@
|
|
30
30
|
|
31
31
|
3
|
32
32
|
|
33
|
-
4
|
33
|
+
4 特徴量の入ったデータ (4 次元)
|
34
34
|
|
35
35
|
----> 5 features = iris.data
|
36
36
|
|
37
|
-
6
|
37
|
+
6 各特徴量の名前
|
38
38
|
|
39
39
|
7 feature_names = iris.feature_names
|
40
40
|
|
@@ -182,35 +182,35 @@
|
|
182
182
|
|
183
183
|
|
184
184
|
|
185
|
-
|
185
|
+
|
186
186
|
|
187
187
|
features = iris.data
|
188
188
|
|
189
|
-
|
189
|
+
|
190
190
|
|
191
191
|
feature_names = iris.feature_names
|
192
192
|
|
193
|
-
|
193
|
+
|
194
194
|
|
195
195
|
targets = iris.target
|
196
196
|
|
197
197
|
|
198
198
|
|
199
|
-
|
199
|
+
|
200
200
|
|
201
201
|
plt.figure(figsize=(12, 8))
|
202
202
|
|
203
203
|
|
204
204
|
|
205
|
-
|
205
|
+
|
206
206
|
|
207
207
|
for i, (x, y) in enumerate(itertools.combinations(range(4), 2)):
|
208
208
|
|
209
|
-
|
209
|
+
|
210
210
|
|
211
211
|
plt.subplot(2, 3, i + 1)
|
212
212
|
|
213
|
-
|
213
|
+
|
214
214
|
|
215
215
|
for t, marker, c in zip(range(3), '>ox', 'rgb'):
|
216
216
|
|
1
少し変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -102,6 +102,86 @@
|
|
102
102
|
|
103
103
|
|
104
104
|
|
105
|
+
|
106
|
+
|
107
|
+
features = iris.data
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
feature_names = iris.feature_names
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
targets = iris.target
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
plt.figure(figsize=(12, 8))
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
for i, (x, y) in enumerate(itertools.combinations(range(4), 2)):
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
plt.subplot(2, 3, i + 1)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
for t, marker, c in zip(range(3), '>ox', 'rgb'):
|
136
|
+
|
137
|
+
plt.scatter(
|
138
|
+
|
139
|
+
features[targets == t, x],
|
140
|
+
|
141
|
+
features[targets == t, y],
|
142
|
+
|
143
|
+
marker=marker,
|
144
|
+
|
145
|
+
c=c,
|
146
|
+
|
147
|
+
)
|
148
|
+
|
149
|
+
plt.xlabel(feature_names[x])
|
150
|
+
|
151
|
+
plt.ylabel(feature_names[y])
|
152
|
+
|
153
|
+
plt.autoscale()
|
154
|
+
|
155
|
+
plt.grid()
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
plt.show()
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
if __name__ == '__main__':
|
166
|
+
|
167
|
+
main()
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
の後に上記のエラーが出てきます。
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
### 試したこと
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
def main():
|
180
|
+
|
181
|
+
iris = datasets.load_iris()
|
182
|
+
|
183
|
+
|
184
|
+
|
105
185
|
# 特徴量の入ったデータ (4 次元)
|
106
186
|
|
107
187
|
features = iris.data
|
@@ -168,86 +248,6 @@
|
|
168
248
|
|
169
249
|
|
170
250
|
|
171
|
-
の後に上記のエラーが出てきます。
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
### 試したこと
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
def main():
|
180
|
-
|
181
|
-
iris = datasets.load_iris()
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
# 特徴量の入ったデータ (4 次元)
|
186
|
-
|
187
|
-
features = iris.data
|
188
|
-
|
189
|
-
# 各特徴量の名前
|
190
|
-
|
191
|
-
feature_names = iris.feature_names
|
192
|
-
|
193
|
-
# データと品種の対応
|
194
|
-
|
195
|
-
targets = iris.target
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
# グラフの全体サイズを指定する
|
200
|
-
|
201
|
-
plt.figure(figsize=(12, 8))
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
# 二次元のグラフを作りたいので特徴量の組み合わせを作る
|
206
|
-
|
207
|
-
for i, (x, y) in enumerate(itertools.combinations(range(4), 2)):
|
208
|
-
|
209
|
-
# サブグラフ
|
210
|
-
|
211
|
-
plt.subplot(2, 3, i + 1)
|
212
|
-
|
213
|
-
# 各品種はマーカーの色や形を変える
|
214
|
-
|
215
|
-
for t, marker, c in zip(range(3), '>ox', 'rgb'):
|
216
|
-
|
217
|
-
plt.scatter(
|
218
|
-
|
219
|
-
features[targets == t, x],
|
220
|
-
|
221
|
-
features[targets == t, y],
|
222
|
-
|
223
|
-
marker=marker,
|
224
|
-
|
225
|
-
c=c,
|
226
|
-
|
227
|
-
)
|
228
|
-
|
229
|
-
plt.xlabel(feature_names[x])
|
230
|
-
|
231
|
-
plt.ylabel(feature_names[y])
|
232
|
-
|
233
|
-
plt.autoscale()
|
234
|
-
|
235
|
-
plt.grid()
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
plt.show()
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
if __name__ == '__main__':
|
246
|
-
|
247
|
-
main()
|
248
|
-
|
249
|
-
|
250
|
-
|
251
251
|
パッケージに保存されているデータだと上手に動きましたが、保存したものだと動きませんでした。
|
252
252
|
|
253
253
|
|