Created
June 13, 2018 16:32
-
-
Save grohith327/fe5251580026c43f0c6f088e342544f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.cross_validation import train_test_split | |
## Retrieve features | |
X = df.values.tolist() | |
Y = [] | |
## Convert classes in Strings to Integers | |
for val in target: | |
if(val == 'Iris-setosa'): | |
Y.append(0) | |
elif(val == 'Iris-virginica'): | |
Y.append(2) | |
else: | |
Y.append(1) | |
## Make them as numpy array | |
X = np.array(X) | |
Y = np.array(Y) | |
## Shuffle and split the data into training and test set | |
x_train, x_test, y_train, y_test = train_test_split(X,Y,train_size=0.9) | |
## Make them as numpy arrays | |
x_train = np.array(x_train) | |
y_train = np.array(y_train) | |
x_test = np.array(x_test) | |
y_test = np.array(y_test) |
The code did run successfully. The accuracy is printed in the output.
Okay I thought the graph that you showed in the article should also be printed.??
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after the scatter plot the whole window disappears and the code exits with 1