Tree as rules:
Rule number:2[Species=setosa cover=38(36%) prob=1.00]
Petal.Length<2.35
Rule number:7[Species=virginica cover=30(29%) prob=0.00]
Petal.Length>=2.35
Petal.Width>=1.65
Rule number:6[Species=versicolor cover=37(35%) prob=0.00]
Petal.Length>=2.35
Petal.Width<1.65[1]21543#Rattle timestamp: 2021-03-24 21:18:48 yangmenglei# Rattle timestamp: 2021-03-24 21:18:47 x86_64-w64-mingw32 # Decision Tree # The 'rpart' package provides the 'rpart' function.library(rpart, quietly=TRUE)# Reset the random number seed to obtain the same results each time.
set.seed(crv$seed)# Build the Decision Tree model.
crs$rpart <-rpart(Species ~.,
data=crs$dataset[crs$train,c(crs$input, crs$target)],
method="class",
parms=list(split="information"),
control=rpart.control(usesurrogate=0,
maxsurrogate=0),
model=TRUE)# Generate a textual view of the Decision Tree model.print(crs$rpart)printcp(crs$rpart)cat("\n")# Time taken: 0.00 secs# List the rules from the tree using a Rattle support function.asRules(crs$rpart)
#=======================================================================
#支持向量机
# Rattle timestamp: 2021-03-24 21:19:17 x86_64-w64-mingw32 # Plot the resulting Decision Tree. # We use the rpart.plot package.fancyRpartPlot(crs$rpart, main="Decision Tree iris2.csv $ Species")
Summary of the SVM model (built using ksvm):
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C =1
Gaussian Radial Basis kernel function.
Hyperparameter : sigma =0.52087038345841
Number of Support Vectors :49
Objective Function Value :-3.5805-3.6993-18.2016
Training error :0.019048
Probability model included.
Time taken:0.83 secs
Rattle timestamp:2021-03-2421:25:15 yangmenglei