Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Lectura de la DB
- MyData <- read.csv(file="C:/Users/56971/Desktop/Analisis de Datos/breast-cancer-wisconsin/breast-cancer-wisconsin/breast-cancer-wisconsin.csv", na.strings='?', header=TRUE, sep=",")
- #Se eliminan las mediciones con datos NA
- cancer <- na.omit(MyData)
- smp_siz <- floor(0.75*nrow(cancer)) # creates a value for dividing the data into train and test. In this case the value is defined as 75% of the number of rows in the dataset
- set.seed(123)
- train_ind = sample(seq_len(nrow(cancer)),size = smp_siz)
- train =cancer[train_ind,]
- test=cancer[-train_ind,]
- model <- naiveBayes(class ~., data = train)
- results <- predict(model, newdata=test)
- View(results)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement