This repository is supposed to contain all my GNU Guile or Scheme machine learning algorithm implementations.

zelphir.kaltstahl 459e0564a1 remove todo, usage of car is OK here 1 month ago
old-racket-code 05f7208871 add racket code test file 1 month ago
scripts 7adfd9baf1 run metrics tests in run test script 1 month ago
test b0d6075bc1 renaming of utils modules 1 month ago
utils b0d6075bc1 renaming of utils modules 1 month ago
.gitignore 81913d80f7 update gitignore to include Emacs files 1 month ago
LICENSE 198d22ffbb Initial commit 2 years ago
README.org fde8c7b798 update readme 1 month ago
columns.csv ced580d8b0 initial commit 2 years ago
data-point.scm 3df084f217 add missing procedure 1 month ago
data_banknote_authentication.csv ced580d8b0 initial commit 2 years ago
dataset.scm b0d6075bc1 renaming of utils modules 1 month ago
decision-tree.scm 459e0564a1 remove todo, usage of car is OK here 1 month ago
metrics.scm 51ef8a8b35 update comment 1 month ago
notes.org 77f93cb446 add more notes about using fibers 1 month ago
prediction.scm 90a79c8f89 separate prediction module 1 month ago
pruning.scm b0d6075bc1 renaming of utils modules 1 month ago
split-quality-measure.scm 0111a9d334 remove commented out Racket expression 1 month ago
todo.org 2dfaac0ed1 update todo 1 month ago
tree.scm b0d6075bc1 renaming of utils modules 1 month ago
utils.scm 74e8f4af8a move list procedures from utils into list utils 1 month ago

README.org

Tests

You can run the tests by running the script run-tests.bash in the scripts/ directory as follows:


# from the root directory of this project:
bash scripts/run-tests.bash

Usage (outdated example)

This example is outdated and still for the older Racket code.


(define shuffled-dataset (shuffle dataset))

(define small-dataset
  (data-range shuffled-dataset
              0
              ;; take only a fifth of the data to make this example run faster
              (exact-floor (/ (dataset-length shuffled-dataset)
                              5))))

;; be sure to collect all garbage, apparently this should be called thrice
(collect-garbage)
(collect-garbage)
(collect-garbage)

;; requires a ~time~ macro
(time
 ;; ~for/list~ -- a Racketism, needs to be rewritten
 (for/list ([i (in-range 1)])
   (mean
    (evaluate-algorithm #:dataset (shuffle dataset)
                        #:n-folds 10
                        #:feature-column-indices (list 0 1 2 3)
                        #:label-column-index 4
                        #:max-depth 5
                        #:min-data-points 24
                        #:min-data-points-ratio 0.02
                        #:min-impurity-split (expt 10 -7)
                        #:stop-at-no-impurity-improvement #t
                        #:random-seed 0))))

;; be sure to collect all garbage, apparently this should be called thrice
(collect-garbage)
(collect-garbage)
(collect-garbage)

(time
 ;; ~for/list~ -- a Racketism, needs to be rewritten
 (for/list ([i (in-range 1)])
   ;; run with the whole dataset as an example, no random seed
   (define tree (fit #:train-data dataset
                     #:feature-column-indices (list 0 1 2 3)
                     #:label-column-index 4
                     #:max-depth 5
                     #:min-data-points 12
                     #:min-data-points-ratio 0.02
                     #:min-impurity-split (expt 10 -7)
                     #:stop-at-no-impurity-improvement #t))
   'done))

Approach

Data representation

  • A dataset is currently represented by a list of vectors. Rows are represented by vectors.