Rambatino / CHAID

A python implementation of the common CHAID algorithm
Apache License 2.0
150 stars 50 forks source link

Risk broken, needs speccing #74

Closed Rambatino closed 5 years ago

Rambatino commented 7 years ago
ipdb> create_tree(self, d_var, column_labels, value_labels).print_tree()
([], {'high': 5320, 'medium': 1923, 'low': 652}, (Please select the emotions that best show how you felt when watching the ad.You can select up to four emotions, or as few as one._Indifferent, p=0.0, score=1432.87251882, groups=[[u'No'], [u'Yes']]), dof=2))
├── ([u'No'], {'high': 4994, 'medium': 1172, 'low': 363}, (Please select the emotions that best show how you felt when watching the ad.You can select up to four emotions, or as few as one._Bored, p=6.6696881578e-272, score=1248.81114438, groups=[[u'No'], [u'Yes']]), dof=2))
│   ├── ([u'No'], {'high': 4931, 'medium': 993, 'low': 206}, <Invalid Chaid Split> - the max depth has been reached)
│   └── ([u'Yes'], {'high': 63, 'medium': 179, 'low': 157}, <Invalid Chaid Split> - the max depth has been reached)
└── ([u'Yes'], {'high': 326, 'medium': 751, 'low': 289}, (Please select the emotions that best show how you felt when watching the ad.You can select up to four emotions, or as few as one._Bored, p=1.99408063179e-18, score=81.5126971319, groups=[[u'No'], [u'Yes']]), dof=2))
    ├── ([u'No'], {'high': 298, 'medium': 558, 'low': 174}, <Invalid Chaid Split> - the max depth has been reached)
    └── ([u'Yes'], {'high': 28, 'medium': 193, 'low': 115}, <Invalid Chaid Split> - the max depth has been reached)

ipdb> create_tree(self, d_var, column_labels, value_labels).risk()
*** ValueError: could not convert string to float: high
Rambatino commented 5 years ago

fixed in