library(plotly)
library(pROC)
library(dplyr)
heart_disease_data <- read.csv("C:/Users/Skj23/Documents/processed.cleveland.data", header = FALSE)
colnames(heart_disease_data) <- c("age", "sex", "cp", "trestbps", "chol", "fbs", "restecg", "thalach", "exang", "oldpeak", "slope", "ca", "thal", "target")
heart_disease_data$target <- ifelse(heart_disease_data$target > 0, "Heart Disease", "Unaffected")
roc_obj <- roc(heart_disease_data$target, heart_disease_data$thalach)
roc_data <- data.frame(TPR = roc_obj$sensitivities, FPR = 1 - roc_obj$specificities)
roc_plot <- plot_ly(data = heart_disease_data, x = ~age, y = ~chol, z = ~thalach, color = ~factor(target), colors = c("red", "grey"), type = 'scatter3d', mode = 'markers') %>% layout(scene = list(xaxis = list(title = 'Age'), yaxis = list(title = 'Cholesterol'), zaxis = list(title = 'Max Heart Rate')), legend = list(title = list(text = 'Condition')))