Demo entry 6623719



Submitted by anonymous on Jun 08, 2017 at 19:17
Language: Python. Code size: 739 Bytes.

import pandas
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score

header = ['sepal-lenght', 'sepal-width', 'petal-lenght', 'petal-width', 'class']
data = pandas.read_csv("", names=header)

arr = data.values
features = arr[:,0:4]
labels = arr[:,4]
features_train, features_test, labels_train, labels_test = train_test_split(features, labels, test_size=0.20, random_state=7)

clf = SVC(kernel='linear'), labels_train)
pred = clf.predict(features_test)

acc = accuracy_score(pred, labels_test)

pred = clf.predict([1.2,4.5,3.7,2.5])

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).