Introduction
I'm learning the basics of AI. I have created a .csv file with random data to test Decision Trees. I'm currently using R in Jupyther Notebook.
Problem
Temperature, Humidity and Wind are the variables which determine if you are allowed to fly or not.
When I execute ctree(vuelo~., data=vuelo.csv)
the output it's just a single node when I was expecting a full tree with the variables (Temperatura, Humdedad, Viento), as I resolved on paper.
The data used is the next table:
temperatura humedad viento vuelo
1 Hot High Weak No
2 Hot High Strong No
3 Hot High Weak Yes
4 Mild High Weak Yes
5 Cool Normal Weak Yes
6 Cool Normal Strong No
7 Cool Normal Strong Yes
8 Mild High Weak No
9 Cool Normal Weak Yes
10 Mild Normal Weak Yes
11 Mild Normal Strong Yes
12 Mild High Strong Yes
13 Hot Normal Weak Yes
14 Mild High Strong No
I'm not sure if I missed something while importing the data, but what I did is:
test <- read.csv("vuelo.csv")
Notes
- I'm using the "party" library from R (which contains examples from where I took some ideas)
EDIT:
Here is the result of dput()
as requested
structure(list(temperatura = structure(c(2L, 2L, 2L, 3L, 1L,
1L, 1L, 3L, 1L, 3L, 3L, 3L, 2L, 3L), .Label = c("Cool", "Hot",
"Mild"), class = "factor"), humedad = structure(c(1L, 1L, 1L,
1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L), .Label = c("High",
"Normal"), class = "factor"), viento = structure(c(2L, 1L, 2L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L), .Label = c("Strong",
"Weak"), class = "factor"), vuelo = structure(c(1L, 1L, 2L, 2L,
2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L), .Label = c("No", "Yes"
), class = "factor")), class = "data.frame", row.names = c(NA,
-14L))