Skip to content

Conversation

@TDerig23
Copy link
Owner

@TDerig23 TDerig23 commented Sep 8, 2022

Bita look at this

# y = species


from sklearn.preprocessing import StandardScaler
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to add all the import commands at the beginning of the code, in one place

datafile ="http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"
#c=pd.read_csv(datafile)
#datafile2 = "/mnt/C:/Users/thoma/OneDrive/Documents/bda602/hw1/bezdekIris.data"
#print(datafile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints the URL not the dataframe, it should be print(c). anyway it's not important just a note


print(iris_data.head())

# def petal_func(columnname):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iris_data.describe() is much more convenient to get all statistics

from sklearn.model_selection import train_test_split
species = iris_data['species']
data_new = iris_data.drop(columns=['species'])
xtrain, xtest, ytrain, ytest = train_test_split(data_new, test_size=0.2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is running for you, but wouldn't run for me. So I noticed you created species and actually never used it. I changed this line to xtrain, xtest, ytrain, ytest = train_test_split(data_new, species, test_size=0.2) and it works now

print(X_train)

# from sklearn.ensemble import RandomForestClassifier
# xtrain, xtest = train_test_split(data_new, test_size=0.2,random_state=123)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there any reason you again divided data into test and train?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants