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

質問編集履歴

1

SVMのコードを全文掲載しました

2019/02/01 07:03

投稿

shibattyo
shibattyo

スコア10

title CHANGED
File without changes
body CHANGED
@@ -14,7 +14,13 @@
14
14
 
15
15
  ```python
16
16
  ソースコード
17
+ AV_df = pd.read_csv("AV1.0~3.0 nomal2.csv")
18
+ x = AV_df.iloc[0:75, [0,1]].values
19
+ y = AV_df.iloc[0:75, 2].values
20
+ model = SVC(kernel = "rbf", random_state = 0, C = 10, gamma = 100 )
21
+ model.fit(x, y)
22
+
17
- ```def plot_decision_regions(X, y, classifier, test_idx=None, resolution=0.02):
23
+ def plot_decision_regions(X, y, classifier, test_idx=None, resolution=0.02):
18
24
  markers = ('s','x','o','^','v')
19
25
  colors = ('red','blue','lightgreen','gray','cyan')
20
26
  cmap = ListedColormap(colors[:len(np.unique(y))])
@@ -34,12 +40,15 @@
34
40
 
35
41
  if test_idx:
36
42
  X_test, y_test = X[test_idx, :], y[test_idx]
37
- plt.scatter(X_test[:,0], X_test[:,1] ,c='', alpha=1.0, linewidth = 1, marker='o', s =55,label = 'test set')![イメージ説明](752036de8e4c37bb5568dd5da108dc00.jpeg)
43
+ plt.scatter(X_test[:,0], X_test[:,1] ,c='', alpha=1.0, linewidth = 1, marker='o', s =55,label = 'test set')
38
44
 
45
+ plot_decision_regions(x, y, classifier = model)
46
+ ```
47
+
39
48
  ### 試したこと
40
49
 
41
50
  ここに問題に対して試したことを記載してください。
42
51
 
43
52
  ### 補足情報(FW/ツールのバージョンなど)
44
-
53
+ ![イメージ説明](b59c33b4eb9fe742994bf53c61022855.jpeg)
45
54
  ここにより詳細な情報を記載してください。