3 ;;; Time-stamp: <2008-11-25 18:56:39 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 'lispstat)
21 ;;(asdf:oos 'asdf:load-op 'lispstat)
23 (in-package :lisp-stat-unittests
)
25 (describe (run-tests :suite
'lisp-stat-ut
))
26 (run-tests :suite
'lisp-stat-ut
)
27 ;; tests = 68, failures = 12, errors = 5
31 ;;; FIXME: Example: currently not relevant, yet
35 :test-case
'lisp-stat-unittests
::create-proto
36 :suite
'lisp-stat-unittests
::lisp-stat-ut-proto
))
39 :;; FIXME: data frames and structural inheritance
41 ;; Serious flaw -- need to consider that we are not really well
42 ;; working with the data structures, in that Luke created compound as
43 ;; a base class, which turns out to be slightly backward if we are to
44 ;; maintain the numerical structures as well as computational
49 ;;; FIXME: Regression modeling
53 (def m
(regression-model (list iron aluminum
) absorbtion
:print nil
))
55 (send m
:sweep-matrix
)
56 (format t
"~%~A~%" (send m
:sweep-matrix
))
58 ;; need to get multiple-linear regression working (simple linear regr
59 ;; works)... to do this, we need to redo the whole numeric structure,
60 ;; I'm keeping these in as example of brokenness...
62 (send m
:basis
) ;; this should be positive?
63 (send m
:coef-estimates
)
65 ;;; FIXME: Need to clean up data examples, licenses, attributions, etc.
67 ;; The following breaks because we should use a package to hold
68 ;; configuration details, and this would be the only package outside
69 ;; of packages.lisp, as it holds the overall defsystem structure.
70 (load-data "iris.lsp") ;; (the above partially fixed).
75 ;;; FIXME: Data.Frames probably deserve to be related to lists --
76 ;;; either lists of cases, or lists of variables. We probably do not
77 ;;; want to mix them, but want to be able to convert between such
80 (defparameter *my-case-data
*
84 (:case3 Y High
3.1 4))
85 (:var-names
(list "Response" "Level" "Pressure" "Size"))))
89 (elt *my-case-data
* 1)
90 (elt *my-case-data
* 0)
91 (elt *my-case-data
* 2) ;; error
92 (elt (elt *my-case-data
* 0) 1)
93 (elt (elt *my-case-data
* 0) 0)
94 (elt (elt (elt *my-case-data
* 0) 1) 0)
95 (elt (elt (elt *my-case-data
* 0) 1) 1)
96 (elt (elt (elt *my-case-data
* 0) 1) 2)
97 (elt (elt *my-case-data
* 0) 3)
100 ;;; FIXME: read data from CSV file. To do.
102 ;; challenge is to ensure that we get mixed arrays when we want them,
103 ;; and single-type (simple) arrays in other cases.
105 (defparameter *csv-num
* (read-csv "Data/example-num.csv" :type
'numeric
))
106 (defparameter *csv-mix
* (read-csv "Data/example-mixed.csv" :type
'data
))
108 ;; The handling of these types should be compariable to what we do for
109 ;; matrices, but without the numerical processing. i.e. mref, bind2,
110 ;; make-dataframe, and the class structure should be similar.
112 ;; With numerical data, there should be a straightforward mapping from
113 ;; the data.frame to a matrix. With categorical data (including
114 ;; dense categories such as doc-strings, as well as sparse categories
115 ;; such as binary data), we need to include metadata about ordering,
116 ;; coding, and such. So the structures should probably consider
118 ;; Using the CSV file:
120 (asdf:oos
'asdf
:compile-op
'csv
:force t
)
121 (asdf:oos
'asdf
:load-op
'parse-number
)
122 (asdf:oos
'asdf
:load-op
'csv
)
123 (fare-csv:read-csv-file
"Data/example-numeric.csv")
125 ;; but I think the cl-csv package is broken, need to use the dsv-style