from sklearn import datasets
from sklearn import svm
import matplotlib.pyplot as plt
import numpy as np
iris = datasets.load_iris()
irisFeatures = iris["data"]
irisFeaturesName = iris["feature_names"]
irisLabels = iris["target"]
irisFeatures = irisFeatures[0:100,:]
irisLabels = irisLabels[0:100]
iris_Setosa = irisFeatures[0:50,:]
iris_Setosa_labels = irisLabels[0:50]
iris_Virginica = irisFeatures[50:100,:]
iris_Virginica_labels = irisLabels[50:100]
iris_Setosa_train = iris_Setosa[0:40,:]
iris_Setosa_labels_train = iris_Setosa_labels[0:40]
iris_Virginica_train = iris_Virginica[0:40,:]
iris_Virginica_labels_train = iris_Virginica_labels[0:40]
iris_Setosa_test = iris_Setosa[40:50,:]
iris_Setosa_labels_test = iris_Setosa_labels[40:50]
iris_Virginica_test = iris_Virginica[40:50,:]
iris_Virginica_labels_test = iris_Virginica_labels[40:50]
iris_Train = np.vstack([iris_Setosa_train,iris_Virginica_train])
irisLabels_Train = np.hstack([iris_Setosa_labels_train,iris_Virginica_labels_train])
iris_Test = np.vstack([iris_Setosa_test,iris_Virginica_test])
irisLabels_Test = np.hstack([iris_Setosa_labels_test,iris_Virginica_labels_test])
clf = svm.SVC(gamma=0.001, C=100.)
clf.fit(iris_Train, irisLabels_Train)
print clf.predict(iris_Test)