SHARE
TWEET

Untitled

a guest Jun 18th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x_min, x_max = x_train[:, 0].min() - .5, x_train[:, 0].max() + .5
  2.     y_min, y_max = x_train[:, 1].min() - .5, x_train[:, 1].max() + .5
  3.     h = (x_max / x_min)/100
  4.     xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
  5.     np.arange(y_min, y_max, h))
  6.     plt.subplot(1, 1, 1)
  7.     Z = svc.predict(np.c_[xx.ravel(), yy.ravel()])
  8.     Z = Z.reshape(xx.shape)
  9.     plt.contourf(xx, yy, Z, cmap=plt.cm.Paired, alpha=0.8)
  10.     plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.Paired)
  11.     plt.xlabel('Sepal length')
  12.     plt.ylabel('Sepal width')
  13.     plt.xlim(xx.min(), xx.max())
  14.     plt.title(title)
  15.     plt.show()
  16.      
  17. [93.86879233 84.77565909 14.79950721 30.08036637 28.32257801 13.65629103
  18.  -1.4152549  -1.06058228  1.08335583]
  19.      
  20. prediction = svm.predict(caracteristicas.reshape(-1,1))[0]
  21.      
  22. #Crear clasificador SVM
  23. svm = SVC(kernel='rbf')
  24. #Entrenar SVM:
  25. svm.fit(x_train.reshape(-1, 1), y_train)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top