In [2]:
import pandas as pd
%matplotlib inline
from sklearn import datasets
from sklearn import tree
import matplotlib.pyplot as plt
In [6]:
iris = datasets.load_iris()
In [ ]:
In [7]:
x = iris.data[:,2:]
In [30]:
x[120]
Out[30]:
In [25]:
def irisclassifier(length,width):
if length <=2.45:
return 'Class 0'
else:
if width<=1.75:
if length<=4.95:
if width<=1.65:
return 'Class 1'
else:
if width<=1.55:
if length <=5.45:
return 'Class 1'
else:
return 'Class 2'
else:
return 'Class 2'
else:
return 'Class 3'
In [31]:
irisclassifier(5.7,2.3)
In [ ]: