Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x_min, x_max = x_train[:, 0].min() - .5, x_train[:, 0].max() + .5
- y_min, y_max = x_train[:, 1].min() - .5, x_train[:, 1].max() + .5
- h = (x_max / x_min)/100
- xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
- np.arange(y_min, y_max, h))
- plt.subplot(1, 1, 1)
- Z = svc.predict(np.c_[xx.ravel(), yy.ravel()])
- Z = Z.reshape(xx.shape)
- plt.contourf(xx, yy, Z, cmap=plt.cm.Paired, alpha=0.8)
- plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.Paired)
- plt.xlabel('Sepal length')
- plt.ylabel('Sepal width')
- plt.xlim(xx.min(), xx.max())
- plt.title(title)
- plt.show()
- [93.86879233 84.77565909 14.79950721 30.08036637 28.32257801 13.65629103
- -1.4152549 -1.06058228 1.08335583]
- prediction = svm.predict(caracteristicas.reshape(-1,1))[0]
- #Crear clasificador SVM
- svm = SVC(kernel='rbf')
- #Entrenar SVM:
- svm.fit(x_train.reshape(-1, 1), y_train)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement