-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHeart Disease Decision Trees.Rmd
55 lines (46 loc) · 1.36 KB
/
Heart Disease Decision Trees.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## Heart Disease Decision Trees
# Loading the data
```{r}
library(FFTrees)
FFTrees.guide()
data(heartdisease)
head(heartdisease)
summary(heartdisease)
```
# Heart Disease Data
For this dataset, there will be information on the first head and summary sets to determine the overall number of heart disease for patients.
```{r}
set.seed(100)
samples <- sample(c(T, F), size = nrow(heartdisease), replace = T)
heartdisease.train <- heartdisease[samples,]
heartdisease.test <- heartdisease[samples == 0,]
heart.FFTrees <- FFTrees(formula = diagnosis ~., data = heartdisease.train,data.test = heartdisease.test)
print(heart.FFTrees)
class(heart.FFTrees)
names(heart.FFTrees)
heart.FFTrees$cue.accuracies
```
# ROC Plot
```{r}
showcues(heart.FFTrees, main = "Heartdisease Cue Accuracy")
```
# Stats
```{r}
heart.FFTrees$FFTrees.stats
summary(heart.FFTrees)
```
# Area Under the Curve
```{r}
heart.FFTrees$auc
```
# Train Decision DF
```{r}
heart.FFTrees$decision.train[1:5,]
heart.FFTrees$levelout.train[1:5,]
```
# Selecting Cues and Plotting Trees
```{r, echo=FALSE}
heart.as.FFTrees <- FFTrees(formula = diagnosis ~ age + sex, data = heartdisease)
plot(heart.FFTrees, main = "Heart Disease",decision.names = c("Healthy", "Disease"))
plot(heart.FFTrees, main = "Heart Disease",decision.names = c("Healthy", "Disease"), train.p = 5)
```