Consider the below given iris data set. This dataset contains 3 classes of 15 instances each and each class refers to a type of iris plant. The dataset has two features: sepal length, sepal width. The third column is for species, which holds the value for these types of plants. A new plant is identified. You have to classify the Species class of new identified plant with the help of KNN algorithm[.Â
the data set consists of 15 samples from each of three species of iris (irise setosa virginace and iris versicolor are the four features were there the iris data set contains four features (length width sepals and petals these can measure were used to create a linear discrimininant model to class species here
library(datasets)
string(iris)
'dateframe' 150 obs. of 5 variables:
sepal.length:num 6.1 4.3 6.1 2.2 6.3 5.5 7.6 8.3 7.1 7.3.....
sepal.width:num 1.3 1.4 5.3 6.2 7.3 8.3 8.1 2.4 4.3 4.4 ....
petal.length:num 4.3 4.8 6.6 8.3 4.9 9.0 1.7 5.7 2.6 4.8...
petal.width: 4.6 7.2 8.4 9.3 5.5 7.9 3.0 6.5 0.7 7.3...
species factor of three classes
subset(iris,species=="setosa")
subset(iris,species=="versicolor")
subset(iris,species=="virginca)
Comments
Leave a comment