REMOVED OLD BROKEN MV REGRESSION (simple worked) IN FAVOR OF LISP-MATRIX VARIANT...
[CommonLispStat.git] / TODO.lisp
blob6b13316529e098b4feb2595bebe0ee0ad90ddd1d
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2008-11-25 08:15:06 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: 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....
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 = 5
30 (in-package :ls-user)
32 ;;; Example: currently not relevant, yet
34 (describe
35 (lift::run-test
36 :test-case 'lisp-stat-unittests::create-proto
37 :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
41 (defparameter m nil
42 "holding variable.")
43 (def m (regression-model (list iron aluminum) absorbtion :print nil))
44 (send m :compute)
45 (send m :sweep-matrix)
46 (format t "~%~A~%" (send m :sweep-matrix))
48 ;;; FIXME
50 ;; need to get multiple-linear regression working (simple linear regr
51 ;; works)... to do this, we need to redo the whole numeric structure,
52 ;; I'm keeping these in as example of brokenness...
54 (send m :basis) ;; this should be positive?
55 (send m :coef-estimates)
57 ;;; FIXME
59 ;; Need to clean up data examples, licenses, attributions, etc.
62 ;; The following breaks because we should use a package to hold
63 ;; configuration details, and this would be the only package outside
64 ;; of packages.lisp, as it holds the overall defsystem structure.
65 (load-data "iris.lsp") ;; (the above partially fixed).
66 (variables)
67 diabetes
70 ;;; FIXME
72 ;; Data.Frames probably deserve to be lists -- either lists of cases,
73 ;; or lists of variables. We probably do not want to mix them, but
74 ;; want to be able to convert between them.
76 (defparameter *my-case-data*
77 '((:cases
78 (:case1 Y Med 3.4 5)
79 (:case2 N Low 3.2 3)
80 (:case3 Y High 3.1 4))
81 (:var-names (list "Response" "Level" "Pressure" "Size"))))
83 *my-case-data*
85 (elt *my-case-data* 1)
86 (elt *my-case-data* 0)
87 (elt *my-case-data* 2) ;; error
88 (elt (elt *my-case-data* 0) 1)
89 (elt (elt *my-case-data* 0) 0)
90 (elt (elt (elt *my-case-data* 0) 1) 0)
91 (elt (elt (elt *my-case-data* 0) 1) 1)
92 (elt (elt (elt *my-case-data* 0) 1) 2)
93 (elt (elt *my-case-data* 0) 3)
96 ;;; FIXME: read data from CSV file. To do.
98 ;; challenge is to ensure that we get mixed arrays when we want them,
99 ;; and single-type (simple) arrays in other cases.
101 (defparameter *csv-num* (read-csv "Data/example-num.csv" :type 'numeric))
102 (defparameter *csv-mix* (read-csv "Data/example-mixed.csv" :type 'data))
104 ;; The handling of these types should be compariable to what we do for
105 ;; matrices, but without the numerical processing. i.e. mref, bind2,
106 ;; make-dataframe, and the class structure should be similar.
108 ;; With numerical data, there should be a straightforward mapping from
109 ;; the data.frame to a matrix. With categorical data (including
110 ;; dense categories such as doc-strings, as well as sparse categories
111 ;; such as binary data), we need to include metadata about ordering,
112 ;; coding, and such. So the structures should probably consider
114 ;; Using the CSV file:
116 (asdf:oos 'asdf:compile-op 'csv :force t)
117 (asdf:oos 'asdf:load-op 'parse-number)
118 (asdf:oos 'asdf:load-op 'csv)
119 (fare-csv:read-csv-file "Data/example-numeric.csv")