Monday, April 1, 2019

importing SKlearn library with their three module in order to compare the prediction result.

# importing SKlearn library with their three module in order to compare the prediction result.


Python Programme:


from sklearn import treefrom sklearn.neighbors import KNeighborsClassifierfrom sklearn.neural_network import MLPClassifier


#height,weight,shoe size

X=[[181,80,44],[177,70,43],[160,60,38],[154,54,37]]Y=['male','female','female','male']

clf=tree.DecisionTreeClassifier()clf1=KNeighborsClassifier(3)clf2= MLPClassifier(alpha=1)

clf=clf.fit(X,Y)clf1=clf1.fit(X,Y)clf2=clf2.fit(X,Y)

prediction=clf.predict([[190,70,43]])prediction1=clf1.predict([[190,70,43]])prediction2=clf2.predict([[190,70,43]])

print (prediction,prediction1,prediction2)

Output:


['male'] ['female'] ['male']


No comments:

Post a Comment

JOB in 2019

Automated - Digital One o One Meetings- An Idea

                                            Automated - Digital One o One Discussion                                                       ...