import pandas as pd
from sklearn import svm, metrics, model_selection
import random, re

# read data from iris csv file
csv = pd.read_csv('iris.csv')

# separate the data to two parts: train and test
data = csv[["SepalLength", "SepalWidth", "PetalLength", "PetalWidth"]]
label = csv["Name"]

# cross validation
clf = svm.SVC()
scores = model_selection.cross_val_score(clf, data, label, cv=5)

print("each right rate: ", scores)
print("average right rate: ", scores.mean())

e08578eee237a60906b1a114c3d2b0c8986c3389
<mask token>

<mask token>
print('each right rate: ', scores)
print('average right rate: ', scores.mean())

<mask token>
csv = pd.read_csv('iris.csv')
data = csv[['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth']]
label = csv['Name']
clf = svm.SVC()
scores = model_selection.cross_val_score(clf, data, label, cv=5)
print('each right rate: ', scores)
print('average right rate: ', scores.mean())

import pandas as pd
from sklearn import svm, metrics, model_selection
import random, re
csv = pd.read_csv('iris.csv')
data = csv[['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth']]
label = csv['Name']
clf = svm.SVC()
scores = model_selection.cross_val_score(clf, data, label, cv=5)
print('each right rate: ', scores)
print('average right rate: ', scores.mean())

import pandas as pd
from sklearn import svm, metrics, model_selection
import random, re

# read data from iris csv file
csv = pd.read_csv('iris.csv')

# separate the data to two parts: train and test
data = csv[["SepalLength", "SepalWidth", "PetalLength", "PetalWidth"]]
label = csv["Name"]

# cross validation
clf = svm.SVC()
scores = model_selection.cross_val_score(clf, data, label, cv=5)

print("each right rate: ", scores)
print("average right rate: ", scores.mean())
