Ishika - BI Lab - Exp 8
Ishika - BI Lab - Exp 8
Implementation:
# Install and load the necessary package
library(rpart)
data(iris)
decision_tree <- rpart(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris, method = "class")
print(decision_tree)
new_data <- data.frame(Sepal.Length = 5.1, Sepal.Width = 3.5, Petal.Length = 1.4, Petal.Width = 0.2)
Output: