(defun equal-width-discretization (data n &optional (cautions (make-caution))) (let ((numbers (sane-numbers data cautions))) ;(setf numbers (mapcar #'(lambda (x) (if (not (= x 0)) (log x) x)) numbers)) (let* ((min (first numbers)) (max (first (last numbers))) (width (/ (- max min) n))) (labels ((datum (cell) (cond ((unknownp cell) cell) ((numberp cell) (discretize cell)) (t *unknown*))) (discretize (m) (float (min max ; don't blow max (+ min ; convert to a number in the same range as before (* width (min n ; don't blow max (1+ (floor (/ (- m min) width)))))))))) (mapcar #'datum data))))) (defun log-continuous (data n &optional (cautions (make-caution))) (let ((numbers (sane-numbers data cautions))) ;(setf numbers (mapcar #'(lambda (x) (if (not (= x 0)) (log x) x)) numbers)) (labels ((datum (cell) (cond ((unknownp cell) cell) ((numberp cell) (discretize cell)) (t *unknown*))) (discretize (m) (if (not (= m 0)) (log m) m))) (mapcar #'datum data))))