CSCI 4150: Introduction to Artificial Intelligence, Fall 2005 |
This procedure takes your discretization procedure, a list of continuous valued attributes to discretize (along with the discretization symbols), training data, and attribute names. It returns a data set with all the (specified) attributes discretized.
Here is an example of how to use this procedure. I've first shown what the procedure you return from your discretization procedure should do for context.
(define scd (list-head country-data 10)) (define p (create-binary-discretization 'population '(many few) scd country-names)) (map p scd) ;Value: ((muslim (green y y n y y n n many 648)) ; (muslim (green y y n y n y y many 2388)) ; (christian (blue y y y n n n n few 0)) ; (catholic (gold y n y n n y n few 0)) ; (christian (white n y y n y n n few 0)) ; (christian (red y y y y y n n few 0)) ; (catholic (blue n y y n y n n many 2777)) ; (christian (blue y y y y n n n few 7690)) ; (catholic (red y y n n y n n few 84)) ; (christian (blue n n y n y n n few 19))) (define q (create-binary-discretization 'area '(big small) scd country-names)) (map q scd) ;Value: ((muslim (green y y n y y n n 16 big)) ; (muslim (green y y n y n y y 20 big)) ; (christian (blue y y y n n n n 0 small)) ; (catholic (gold y n y n n y n 0 small)) ; (christian (white n y y n y n n 0 small)) ; (christian (red y y y y y n n 0 small)) ; (catholic (blue n y y n y n n 28 big)) ; (christian (blue y y y y n n n 15 big)) ; (catholic (red y y n n y n n 8 big)) ; (christian (blue n n y n y n n 0 small))) (define r (discretize-tdata create-binary-discretization '((population many few) (area big small)) scd country-names)) r ;Value: ((muslim (green y y n y y n n many big)) ; (muslim (green y y n y n y y many big)) ; (christian (blue y y y n n n n few small)) ; (catholic (gold y n y n n y n few small)) ; (christian (white n y y n y n n few small)) ; (christian (red y y y y y n n few small)) ; (catholic (blue n y y n y n n many big)) ; (christian (blue y y y y n n n few big)) ; (catholic (red y y n n y n n few big)) ; (christian (blue n n y n y n n few small)))
For example, using the scd data set above:
(majority-attribute-value scd country-names 'maincolor) ;Value: blue
Given a list s (which could be training data), pick a subset of size size.
Given a list s, randomly divide it into two equal parts. The two resulting lists are returned in a two-element list.