fzalkow / cl-mlep Goto Github PK
View Code? Open in Web Editor NEWcl-mlep is a Common Lisp Machine Learning library for Educational Purposes.
License: MIT License
cl-mlep is a Common Lisp Machine Learning library for Educational Purposes.
License: MIT License
Hello Frank,
I'm glad to have found this library; I've been looking for some machine learning code in Common Lisp that doesn't have a restrictive license, and found this because I'm the new maintainer of LLA, and when updating it in Quicklisp discovered some breakage.
cl-num-utils
has been updated and renamed num-utils
, and that's what now LLA uses. Here, when used together, there is a package name clash because LLA and cl-num-utils aren't in sync.
The fix is to change cl-num-utils
-> num-utils
in the mlep-add ASDF file.
Got a version of transpose that does not cause nil's and thus no crash from http://comments.gmane.org/gmane.lisp.slime.devel/3887.
(defun transpose-list (l)
(cond ((some #'null l) '())
(t (cons (mapcar #'car l)
(transpose-list (mapcar #'cdr l)))))
)
Would you be interested in working together on an updated version of cl-mlep based on Lisp-Stat? Data frames, plotting and statistics are all built-in and I think cl-mlep would make a great introduction/tutorial for Lisp-Stat.
The following code is crashing run byes
(setf labels '(2 1 1 1 1 1 1 1))
(setf test-set '((99 0 21 98 97 0 0 0 0 96 95 18 94 84 93 14 13 53 92 10 9 8 91 90 89 88 87)))
(setf data '((86 0 21 85 0 0 0 0 0 67 19 18 67 84 83 14 13 63 62 10 9 82 81 80 79 78 3)
(77 0 21 76 0 0 0 0 0 75 19 18 74 65 73 14 13 63 52 10 9 72 71 70 59 69 3)
(68 0 21 56 0 0 0 0 0 67 19 18 66 65 64 14 13 63 62 10 9 8 61 60 59 58 3)
(57 0 21 56 0 0 0 0 0 55 19 18 55 43 54 14 13 53 52 10 9 8 51 50 49 48 3)
(47 0 21 46 0 0 0 0 0 45 19 18 44 43 42 14 13 12 11 10 9 8 41 40 39 38 3)
(37 0 21 20 0 0 0 0 0 36 19 18 35 27 15 14 13 12 34 10 9 8 33 32 31 30 3)
(29 0 21 20 0 0 0 0 0 28 19 18 28 27 15 14 13 12 11 10 9 8 26 25 24 23 3)
(22 0 21 20 0 0 0 0 0 17 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3)))
(setf my-bayes (make-instance 'mlep:naive-bayes
:data-set data
:set-labels labels
:test-set test-set))
If I hack the code like this it removes the error but I dont know if the default value of eish should be 0.
(defmethod run ((instance naive-bayes) &key)
(declare (optimize (debug 3)))
(with-slots (data-set set-labels test-set all-labels prior-probabilities likelihoods) instance
(when (/= (length data-set) (length set-labels))
(error "Each item in data-set' has to have a label in
set-labels'. (At the moment they are of unequal length.)"))
(let ((result))
(dolist (item test-set (nreverse result))
(let ((probabilities))
(dolist (label all-labels)
(let ((tmp-prob (rest (find label prior-probabilities :key #'first))))
(dotimes (i (length item))
(let ((eish (cddar (member-if #'(lambda (lik)
(and (eql (first lik)
label)
(equal (second lik)
(cons i (nth i item)))))
likelihoods))))
(setf tmp-prob (* tmp-prob (if eish eish 0)))))
(push tmp-prob probabilities)))
(push (nth (max-arg (nreverse probabilities)) all-labels) result))))))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.