(defstruct eg features class) (defun data (&key name columns egs change (klass -1) shufflep) (let* ((tbl (make-table :name name :columns (columns-new columns (class-index klass (length columns))))) (egs1 (if shufflep (shuffle egs) egs))) (setf (table-class tbl) (class-index klass (table-width tbl))) (dolist (eg egs1 tbl) (data1 eg change klass tbl)))) (defun data1 (one change klass tbl) (when (ok (= (table-width tbl) (length one)) (table-cautions tbl) "~a wrong size" one) (if change (setf one (sublis change one))) (counted+ (make-eg :class (isa one tbl) :features one) (table-all tbl)))) (defun class-index (klass width) (if (< klass 0) (+ klass width) klass)) (defun make-data1 () (data :name 'weather :columns '(forecast temp humidty $windy play) :egs '((sunny hot high FALSE no) (sunny hot high TRUE yes) (sunny hot high yes) ) :change '((yes . 2) (no . 1))))