clean up of demos and comment strings.
[CommonLispStat.git] / TODO.lisp
blobd060c22202efac59c27d6f0e8ea72e30a9162ad1
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2008-12-08 09:39:01 tony>
4 ;;; Creation: <2008-09-08 08:06:30 tony>
5 ;;; File: TODO.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c) 2007-2008, AJ Rossini <blindglobe@gmail.com>. BSD.
8 ;;; Purpose: Stuff that needs to be made working sits inside the progns...
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....
17 ;;; SET UP
19 (in-package :cl-user)
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 = 7
29 (in-package :ls-user)
31 ;;; FIXME: Example: currently not relevant, yet
33 (describe
34 (lift::run-test
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
45 ;; efficiency.
50 #+nil
51 (progn ;; FIXME: Regression modeling
53 (defparameter m nil
54 "holding variable.")
55 ;; need to make vectors and matrices from the lists...
57 (def m (regression-model iron absorbtion :print nil))
58 (def m (regression-model (list iron aluminum) absorbtion :print nil))
60 (defparameter *indep-vars-1-matrix*
61 (make-matrix 1 (length iron)
62 :initial-contents
63 (list (mapcar #'(lambda (x) (coerce x 'double-float))
64 iron))))
65 ;; *indep-vars-1-matrix*
67 (defparameter *indep-vars-2-matrix*
68 (make-matrix 2 (length iron)
69 :initial-contents
70 (list
71 (mapcar #'(lambda (x) (coerce x 'double-float))
72 iron)
73 (mapcar #'(lambda (x) (coerce x 'double-float))
74 aluminum))))
75 ;; *indep-vars-2-matrix*
78 ;; FAILS due to coercion issues; it just isn't lispy, it's R'y.
79 ;; (defparameter *dep-var* (make-vector (length absorbtion)
80 ;; :initial-contents (list absorbtion)))
81 ;; BUT this should be the right type.
82 (defparameter *dep-var*
83 (make-vector (length absorbtion)
84 :type :row
85 :initial-contents
86 (list
87 (mapcar #'(lambda (x) (coerce x 'double-float))
88 absorbtion))))
89 ;; *dep-var*
92 (defparameter *dep-var-int*
93 (make-vector (length absorbtion)
94 :type :row
95 :element-type 'integer
96 :initial-contents (list absorbtion)))
98 (typep *dep-var* 'matrix-like) ; => T
99 (typep *dep-var* 'vector-like) ; => T
101 (typep *indep-vars-1-matrix* 'matrix-like) ; => T
102 (typep *indep-vars-1-matrix* 'vector-like) ; => T
103 (typep *indep-vars-2-matrix* 'matrix-like) ; => T
104 (typep *indep-vars-2-matrix* 'vector-like) ; => F
106 (def m1 (regression-model-new *indep-vars-1-matrix* *dep-var* ))
107 (def m2 (regression-model-new *indep-vars-2-matrix* *dep-var* ))
109 iron
110 ;; following fails, need to ensure that we work on list elts, not just
111 ;; elts within a list:
112 ;; (coerce iron 'real)
114 ;; the following is a general list-conversion coercion approach -- is
115 ;; there a more efficient way?
116 (mapcar #'(lambda (x) (coerce x 'double-float)) iron)
118 (coerce 1 'real)
120 (send m :compute)
121 (send m :sweep-matrix)
122 (format t "~%~A~%" (send m :sweep-matrix))
124 ;; need to get multiple-linear regression working (simple linear regr
125 ;; works)... to do this, we need to redo the whole numeric structure,
126 ;; I'm keeping these in as example of brokenness...
128 (send m :basis) ;; this should be positive?
129 (send m :coef-estimates) )
131 #+nil
132 (progn ;; FIXME: Need to clean up data examples, licenses, attributions, etc.
133 ;; The following breaks because we should use a package to hold
134 ;; configuration details, and this would be the only package outside
135 ;; of packages.lisp, as it holds the overall defsystem structure.
136 (load-data "iris.lsp") ;; (the above partially fixed).
137 (variables)
138 diabetes )
140 #+nil
141 (progn ;; FIXME: Data.Frames probably deserve to be related to lists --
142 ;; either lists of cases, or lists of variables. We probably do not
143 ;; want to mix them, but want to be able to convert between such
144 ;; structures.
146 (defparameter *my-case-data*
147 '((:cases
148 (:case1 Y Med 3.4 5)
149 (:case2 N Low 3.2 3)
150 (:case3 Y High 3.1 4))
151 (:var-names (list "Response" "Level" "Pressure" "Size"))))
153 *my-case-data*
155 (elt *my-case-data* 1)
156 (elt *my-case-data* 0)
157 (elt *my-case-data* 2) ;; error
158 (elt (elt *my-case-data* 0) 1)
159 (elt (elt *my-case-data* 0) 0)
160 (elt (elt (elt *my-case-data* 0) 1) 0)
161 (elt (elt (elt *my-case-data* 0) 1) 1)
162 (elt (elt (elt *my-case-data* 0) 1) 2)
163 (elt (elt *my-case-data* 0) 3))
165 #+nil
166 (progn ;; FIXME: read data from CSV file. To do.
168 ;; challenge is to ensure that we get mixed arrays when we want them,
169 ;; and single-type (simple) arrays in other cases.
171 (defparameter *csv-num* (read-csv "Data/example-num.csv" :type 'numeric))
172 (defparameter *csv-mix* (read-csv "Data/example-mixed.csv" :type 'data))
174 ;; The handling of these types should be compariable to what we do for
175 ;; matrices, but without the numerical processing. i.e. mref, bind2,
176 ;; make-dataframe, and the class structure should be similar.
178 ;; With numerical data, there should be a straightforward mapping from
179 ;; the data.frame to a matrix. With categorical data (including
180 ;; dense categories such as doc-strings, as well as sparse categories
181 ;; such as binary data), we need to include metadata about ordering,
182 ;; coding, and such. So the structures should probably consider
184 ;; Using the CSV file:
186 (asdf:oos 'asdf:compile-op 'csv :force t)
187 (asdf:oos 'asdf:load-op 'parse-number)
188 (asdf:oos 'asdf:load-op 'csv)
189 (fare-csv:read-csv-file "Data/example-numeric.csv")
191 ;; but I think the cl-csv package is broken, need to use the dsv-style
192 ;; package.