The following are the steps for working with the SVM method

## #LOAD LIBRARY AND DATASET

`library(e1071)`

library(devtools)

library(caret)

library(survival)data =na.omit(kidney)

View(data)

## #Divided dataset into training and testing data to evaluate the created model

`#data train dan data test`

n_data = round(nrow(data)*0.75)

n_data

set.seed(12345)

sample_data = sample(seq_len(nrow(data)), size = n_data)

train_data = data[sample_data,]

test_data = data[-sample_data,]

nrow(train_data)

nrow(test_data)

of data preparation is breaking the data set into 2 parts. The larger part of 75% will be used as training data while the smaller part of 25% will be used as testing data for evaluation purposes. Well-prepared data for your model can increase its efficiency.

## #MAKE SVM MODEL

`#Model SVM`

data.svm_data = svm(as.factor(status)~., data = train_data)

data.svm_data

Klasifikasi menggunakan metode SVM pada data train dimana tipe metode Support Vector Machine (SVM) data training berupa C-Classification dimana C-Classification merupakan suatu pendekatan untuk menangani masalah klasifikasi dengan lebih dari dua kelas dengan menggunakan salah satu pendekatan yang ada pada SVM untuk menghasilkan prediksi akhir. Nilai parameter pada metode SVM data training sebesar 1 dengan banyaknya angka yang mendukung atau number of support vector yang dibentuk sebesar 33.

Next, we will make predictions using the data train on the SVM method using the following command.

`prediksi1_data = predict(data.svm_data, train_data)`

prediksi1_data

table(prediksi1_data)

Based on this output, the predicted value for each category is obtained. The category ‘0(zero)’ means that the predictive value of a person living due to kidney disease is 3 people, while the category ‘1(one)’ means that there are 54 people who died from kidney disease.

Next, we will see the level of accuracy of the SVM model when using the train data.

`confusionMatrix(prediksi1_data, factor(train_data$status))`

Based on the output, it states that the level of accuracy in the data train is based on the SVM model with the Radial Basis Function (RBF) kernel with an accuracy rate of 80.07% and has a 95% confidence interval value that is within the range of 68.09% to 89, 95%. Where after the previous prediction it turned out to be in the category ‘0 (zero)’, namely someone who lives because of kidney disease is 11 and also in the category ‘1 (one)’ someone who dies because of kidney disease is 43

Then next we will do the second prediction using test data with the following command.

`prediksi2_data = predict(data.svm_data, test_data)`

prediksi2_data

table(prediksi2_data)

Based on this output, the predicted value for each category is obtained. For the category ‘0 (zero)’ means that the predictive value of someone who lives due to heart disease is 1 while the category ‘1 (one)’ means that the predictive value of someone who dies from heart disease is 18.

Next, we will see the level of accuracy of the test data using the following command.

`confusionMatrix(prediksi2_data, factor(test_data$status))`

Based on the output, it states that the level of accuracy in the test data is based on the SVM model with the Radial Basis Fuction (RBF) kernel with an accuracy rate of 84.24% and has a 95% confidence interval value which is precisely within the range of 60.42% to 96.62%. Where after previously predicted in the category ‘0 (zero)’, namely someone who lives due to kidney disease is 15 and also ‘1 (one)’ someone who dies due to kidney disease is actually 3.