Heart failure clinical Data Analysis



Download 428.37 Kb.
Page6/9
Date16.12.2020
Size428.37 Kb.
#54654
1   2   3   4   5   6   7   8   9
466 project
466 project

Support Vector Machine


Support vector machine (SVM) is a type of supervised machine learning algorithm, that analyze the data for classification and regression analysis. Each data item is shown as a point in n-dimensional space in this algorithm, with the value of each function being the value of each coordinate. Then, classification is done by determining the strongest differentiating hyperplane for the two classes. This model is used by most state-of-the-art approaches [8][9][10] for classification purpose. For experiment, we have 0.7 for training of the model and 0.3 for testing of the model. Our experiment shows that we have achieved accuracy of 0.83. The confusion matrix of the SVM is shown in Table 1.

# Importing the dataset

df = read.csv('heart_failure_clinical_records_dataset.csv',header = TRUE)

install.packages("caret")

library('caret')

intrain <- createDataPartition(y = df$DEATH_EVENT, p= 0.7, list = FALSE)

training <- df[intrain,]

testing <- df[-intrain,]

training[["DEATH_EVENT"]] = factor(training[["DEATH_EVENT"]])

trctrl <- trainControl(method = "repeatedcv", number = 10, repeats = 3)

svm_Linear <- train(DEATH_EVENT ~., data = training, method = "svmLinear",

trControl=trctrl,

preProcess = c("center", "scale"),

tuneLength = 10)

svm_Linear

test_pred <- predict(svm_Linear, newdata = testing)

test_pred

confusionMatrix(table(test_pred, testing$DEATH_EVENT))

Test_pred

0

1

0

70

15

1

8

26

Table 1: Confusion Matrix

  1. Download 428.37 Kb.

    Share with your friends:
1   2   3   4   5   6   7   8   9




The database is protected by copyright ©ininet.org 2024
send message

    Main page