3 ;;; Time-stamp: <2009-01-23 13:13:35 tony>
4 ;;; Creation: <2008-03-11 19:18:34 user>
5 ;;; File: cross-validation.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. BSD, LLGPL, or GPLv2, depending
9 ;;; Purpose: cross-validation algorithms for CLS
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
15 (in-package :cls-algorithms-crossvalidation
)
17 ;;; implememented through general macros for a lispy approach. There
18 ;;; could be a functional approach as well, i.e.
19 ;;; (bootstrap data #'function args)
22 (defmacro with-data-crossvalidate
((list-of-sources-and-var n
) @body
)
23 "A proposed lispy implementation, such as:
24 (with-data-crossvalidate ((a dataset1)
26 (some-form-with-inputs a b c))
27 where there could be multiple datasets, with a and b, etc, being
28 bootstrap realizations of dataset1 and dataset2."
29 (Destructure list-of-sources-and-var
)
31 (progn (pull-samples sources
)
33 accumulate in result-list
))
35 (defmacro with-correlated-data-crossvalidate
)
37 (defgeneric crossvalidate
(data function args
)
38 (:documentation
"used such as: (bootstrap dataset t-test :significance 0.5)")
39 (:default-method
(funcall #'function
(bootstrap-sample data
) (values args
))))
47 (with-data-crossvalidate ((a dataset1
))
48 (t-test a
:significance
0.05))
50 (crossvalidate #'t-test a
:significance
0.05)