Get Accuracy or Kappa of this model?

Hi community,
Im want to obtain the accuracy or kappa for compare this models. I dont have high experiences with this topics

completedData <- structure(list(edad = c(19L, 18L, 28L, 33L, 32L, 31L, 46L, 37L, 
37L, 60L, 25L, 62L, 23L, 56L, 27L, 19L, 52L, 23L, 56L, 30L, 60L, 
30L, 18L, 34L, 37L, 59L, 63L, 55L, 23L, 31L, 22L, 18L, 19L, 63L, 
28L, 19L, 62L, 26L, 35L, 60L, 24L, 31L, 41L, 37L, 38L, 55L, 18L, 
28L, 60L, 36L), sexo = c(1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 
1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 
1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L), masa_corporal = c(27.9, 
33.77, 33, 22.705, 28.88, 25.74, 33.44, 27.74, 29.83, 25.84, 
26.22, 26.29, 34.4, 39.82, 42.13, 24.6, 30.78, 23.845, 40.3, 
35.3, 36.005, 32.4, 34.1, 31.92, 28.025, 27.72, 23.085, 32.775, 
17.385, 36.3, 35.6, 26.315, 28.6, 28.31, 36.4, 20.425, 32.965, 
20.8, 36.67, 39.9, 26.6, 36.63, 21.78, 30.8, 37.05, 37.3, 38.665, 
34.77, 24.53, 35.2), num_hijos = c(0L, 1L, 3L, 0L, 0L, 0L, 1L, 
3L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 
1L, 2L, 3L, 0L, 2L, 1L, 2L, 0L, 0L, 5L, 0L, 1L, 0L, 3L, 0L, 1L, 
0L, 0L, 2L, 1L, 2L, 1L, 0L, 2L, 0L, 0L, 1L), fumador = c(2L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 
1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 
1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
2L), region = c(4L, 3L, 3L, 2L, 2L, 3L, 3L, 2L, 1L, 2L, 1L, 3L, 
4L, 3L, 3L, 4L, 1L, 1L, 4L, 4L, 1L, 4L, 3L, 1L, 2L, 3L, 1L, 2L, 
2L, 4L, 4L, 1L, 4L, 2L, 4L, 2L, 2L, 4L, 1L, 4L, 1L, 3L, 3L, 3L, 
1L, 4L, 1L, 2L, 3L, 3L), cargo_seguromed = c(16884.924, 1725.5523, 
4449.462, 21984.47061, 3866.8552, 3756.6216, 8240.5896, 7281.5056, 
6406.4107, 28923.13692, 2721.3208, 27808.7251, 1826.843, 11090.7178, 
39611.7577, 1837.237, 10797.3362, 2395.17155, 10602.385, 36837.467, 
13228.84695, 4149.736, 1137.011, 37701.8768, 6203.90175, 14001.1338, 
14451.83515, 12268.63225, 2775.19215, 38711, 35585.576, 2198.18985, 
4687.797, 13770.0979, 51194.55914, 1625.43375, 15612.19335, 2302.3, 
39774.2763, 48173.361, 3046.062, 4949.7587, 6272.4772, 6313.759, 
6079.6715, 20630.28351, 3393.35635, 3556.9223, 12629.8967, 38709.176
)), row.names = c(NA, 50L), class = "data.frame")
library(factoextra)
library(dlookr)
library(ggplot2)
library(funModeling)
library(dplyr)
library(caret)
library(klaR)
set.seed(100) 
trainingRowIndex <- sample(1:nrow(completedData), 0.8*nrow(completedData)) d
train.data  <- completedData[trainingRowIndex, ] 
test.data  <- completedData[-trainingRowIndex, ]

control = trainControl(method="repeatedcv", number=10, repeats=3)
#metric <- "RMSE"

#2 , variable continua
#Regresión Lineal Múltiple
st.time<-Sys.time()
fit.lm <- train(cargo_seguromed~edad+masa_corporal,
                data = train.data, method="lm", 
                metric="RMSE", trControl=control)
end.time<-Sys.time()
end.time-st.time
-----
#árbol de decisión
st.time<-Sys.time()
fit.dt <- train(cargo_seguromed~edad+masa_corporal,
                data = train.data, method="rpart", 
                metric="RMSE", 
                trControl=control,na.action=na.omit,tuneLength=5)
end.time<-Sys.time()
end.time-st.time
---

#redes neuronales
st.time<-Sys.time()
fit.nn <- train(cargo_seguromed~edad+masa_corporal,data = train.data,
                method = "nnet",metric="RMSE",trControl = control,linout=TRUE,
                preProcess=c("scale","center"),na.action = na.omit,trace=F,maxit = 1000,tunelength=9)
end.time<-Sys.time()
end.time-st.time
----


##K-vecinos más cercanos
st.time<-Sys.time()
fit.knn <- train(cargo_seguromed~edad+masa_corporal,data = train.data, 
                 method="knn", metric="RMSE",
                 linout=TRUE, preProcess=c("scale","center"), 
                 trControl=control,na.action=na.omit)
end.time<-Sys.time()
end.time-st.time

Any ideas is good for me.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.