3 ;;; Time-stamp: <2008-11-21 15:26:23 tony>
4 ;;; Creation: <2008-09-08 08:06:30 tony>
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c) 2007-2008, AJ Rossini <blindglobe@gmail.com>. BSD.
8 ;;; Purpose: demonstrations of how one might use CLS.
10 ;;; What is this talk of 'release'? Klingons do not make software
11 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
12 ;;; designers and quality assurance people in its wake.
14 ;;; This file contains the current challenges to solve, including a
15 ;;; description of the setup and the work to solve....
20 ;;(asdf:oos 'asdf:compile-op 'lift :force t)
21 ;;(asdf:oos 'asdf:load-op 'lift)
22 ;;(asdf:oos 'asdf:compile-op 'lispstat)
23 ;;(asdf:oos 'asdf:load-op 'lispstat)
25 (in-package :lisp-stat-unittests
)
27 (describe (run-tests :suite
'lisp-stat-ut
))
28 (run-tests :suite
'lisp-stat-ut
)
29 ;; tests = 68, failures = 12, errors = 5
34 ;;; Example: currently not relevant, yet
38 :test-case
'lisp-stat-unittests
::create-proto
39 :suite
'lisp-stat-unittests
::lisp-stat-ut-proto
))
45 (def m
(regression-model (list iron aluminum
) absorbtion
:print nil
))
47 (send m
:sweep-matrix
)
48 (format t
"~%~A~%" (send m
:sweep-matrix
))
52 ;; need to get multiple-linear regression working (simple linear regr
53 ;; works)... to do this, we need to redo the whole numeric structure,
54 ;; I'm keeping these in as example of brokenness...
56 (send m
:basis
) ;; this should be positive?
57 (send m
:coef-estimates
)
61 ;; Need to clean up data examples, licenses, attributions, etc.
64 ;; The following breaks because we should use a package to hold
65 ;; configuration details, and this would be the only package outside
66 ;; of packages.lisp, as it holds the overall defsystem structure.
67 (load-data "iris.lsp") ;; (the above partially fixed).
74 ;; Data.Frames probably deserve to be lists -- either lists of cases,
75 ;; or lists of variables. We probably do not want to mix them, but
76 ;; want to be able to convert between them.
78 (defparameter *my-case-data
*
82 (:case3 Y High
3.1 4))
83 (:var-names
(list "Response" "Level" "Pressure" "Size"))))
87 (elt *my-case-data
* 1)
88 (elt *my-case-data
* 0)
89 (elt *my-case-data
* 2) ;; error
90 (elt (elt *my-case-data
* 0) 1)
91 (elt (elt *my-case-data
* 0) 0)
92 (elt (elt (elt *my-case-data
* 0) 1) 0)
93 (elt (elt (elt *my-case-data
* 0) 1) 1)
94 (elt (elt (elt *my-case-data
* 0) 1) 2)
95 (elt (elt *my-case-data
* 0) 3)
98 ;;; FIXME: read data from CSV file. To do.
100 ;; challenge is to ensure that we get mixed arrays when we want them,
101 ;; and single-type (simple) arrays in other cases.
103 (defparameter *csv-num
* (read-csv "Data/example-num.csv" :type
'numeric
))
104 (defparameter *csv-mix
* (read-csv "Data/example-mixed.csv" :type
'data
))
106 ;; The handling of these types should be compariable to what we do for
107 ;; matrices, but without the numerical processing. i.e. mref, bind2,
108 ;; make-dataframe, and the class structure should be similar.
110 ;; With numerical data, there should be a straightforward mapping from
111 ;; the data.frame to a matrix. With categorical data (including
112 ;; dense categories such as doc-strings, as well as sparse categories
113 ;; such as binary data), we need to include metadata about ordering,
114 ;; coding, and such. So the structures should probably consider
116 ;; Using the CSV file:
118 (asdf:oos
'asdf
:compile-op
'csv
:force t
)
119 (asdf:oos
'asdf
:load-op
'parse-number
)
120 (asdf:oos
'asdf
:load-op
'csv
)
121 (fare-csv:read-csv-file
"Data/example-numeric.csv")