File: test-learning.lisp

package info (click to toggle)
cl-aima 1.0.4-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,180 kB
  • ctags: 1,575
  • sloc: lisp: 6,593; makefile: 58; sh: 28
file content (59 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(deftest learning
  ((setq p *restaurant-boolean-problem*))
  ((setq e (learning-problem-examples p) 
         g (learning-problem-goals p)))
  ((setq h (decision-list-learning 4 p)))
  ((accuracy h #'dlpredict e g)
   (= * 1.0))
  ((setq p *restaurant-multivalued-problem*))
  ((setq e (learning-problem-examples p) 
         g (learning-problem-goals p)))
  ((setq h (decision-tree-learning p)))
  ((accuracy h #'dtpredict e g)
   (= * 1.0))
  ((setq p *majority-boolean-problem*))
  ((setq e (learning-problem-examples p) 
         a (learning-problem-attributes p) 
         g (learning-problem-goals p)))
  ((setq h (nn-learning p (make-perceptron 11 1) #'perceptron-update)))
  ((accuracy h #'(lambda (e1 h1) (nn-output e1 h1 a g)) e g)
   (> * 0.8))
  ((setq p *restaurant-real12-problem*))
  ((setq e (learning-problem-examples p) 
         a (learning-problem-attributes p) 
         g (learning-problem-goals p)))
  ((setq h (nn-learning p (make-connected-nn '(10 4 1)) #'backprop-update)))
  ((accuracy h #'(lambda (e1 h1) (nn-output e1 h1 a g)) e g #'rms-error)
   (> * 0.8))
  ((setq a (make-mdp-agent
	     :name 'LM :program (make-passive-lms-learner))))
  ((setq e (make-mdp-environment :mdp *4x3-passive-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs
  ((setq a (make-mdp-agent
	     :name 'TD :program (make-passive-td-learner))))
  ((setq e (make-mdp-environment :mdp *4x3-passive-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs
  ((setq a (make-mdp-agent :name 'MA 
	     :program (make-maximizing-adp-learner '(left right up down)))))
  ((setq e (make-mdp-environment :mdp *4x3-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs
  ((setq a (make-mdp-agent :name 'QI
	     :program (make-maximizing-qi-learner '(left right up down)))))
  ((setq e (make-mdp-environment :mdp *4x3-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs
  ((setq a (make-mdp-agent :name 'EA
	     :program (make-exploring-adp-learner '(left right up down)))))
  ((setq e (make-mdp-environment :mdp *4x3-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs
  ((setq a (make-mdp-agent :name 'TQ
	     :program (make-exploring-tdq-learner '(left right up down)))))
  ((setq e (make-mdp-environment :mdp *4x3-mdp* :agents (list a)
				 :epochs-left 2)))
  ((run-environment e))  ;;; for now just make sure it runs

  )