-
-
Save grohith327/fe5251580026c43f0c6f088e342544f5 to your computer and use it in GitHub Desktop.
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) |
This gist uses an old version of sklearn. The train_test_split
module has been to moved to model_selection
. Use the following import command instead of one on line 2. from sklearn.model_selection import train_test_split
when i tried to run this file along with the other 3 files there is some error in cross_validation. Do we have to use some different version of scikit learn lib or what?
Only this part is troubling me
I don't know if can help me further or not but only up to scatter plot is resulting as an output. I changed it to model.selection but still
Please post the error you are facing
after the scatter plot the whole window disappears and the code exits with 1
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.??
when i tried to run this file along with the other 3 files there is some error in cross_validation. Do we have to use some different version of scikit learn lib or what?
Only this part is troubling me