The iris data set gives the measurements in centimeters of the variables sepal length and width, and petal length and width, respectively, for 500 flowers from each of 3 species of iris. The species are Iris setosa, versicolor and virginica.
The dataframe consists of 150 cases (rows) and 5 variables (columns) named
Sepal.Length
, Sepal.Width
, Petal.Length
, Petal.Width
and Species
.
dim(iris)
[1] 150 5
names(iris)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
iris
data set (for this you can use the sample()
function).
Store the training data in train
and test data in test
.cost
parameter
with a range of (0.001, 0.01, 0.1, 1, 10, 100)
.
tune.out
.bestmod
.score
.Assume that:
e1071
library has been loadediris
data set has been loaded and attached