id int64 0 45.1k | file_name stringlengths 4 68 | file_path stringlengths 14 193 | content stringlengths 32 9.62M | size int64 32 9.62M | language stringclasses 1
value | extension stringclasses 6
values | total_lines int64 1 136k | avg_line_length float64 3 903k | max_line_length int64 3 4.51M | alphanum_fraction float64 0 1 | repo_name stringclasses 779
values | repo_stars int64 0 882 | repo_forks int64 0 108 | repo_open_issues int64 0 90 | repo_license stringclasses 8
values | repo_extraction_date stringclasses 146
values | sha stringlengths 64 64 | __index_level_0__ int64 0 45.1k | exdup_ids_cmlisp_stkv2 listlengths 1 47 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,168 | cats-and-dogs.lisp | chunsj_TH/db/cats-and-dogs.lisp | (declaim (optimize (speed 3) (debug 0) (safety 0)))
(defpackage :th.db.cats-and-dogs
(:use #:common-lisp
#:mu
#:th)
(:export #:read-cats-and-dogs-data))
(in-package :th.db.cats-and-dogs)
(defparameter +cnd-location+ ($concat (namestring (user-homedir-pathname))
... | 1,896 | Common Lisp | .lisp | 40 | 32.85 | 101 | 0.470016 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 45d03a1ac624919bf9799a5aa476571365f3a43cc47e43dd3fcbf740170047a4 | 3,168 | [
-1
] |
3,169 | fashion-original.lisp | chunsj_TH/db/fashion-original.lisp | (declaim (optimize (speed 3) (debug 0) (safety 0)))
(defpackage :th.db.fashion-original
(:use #:common-lisp
#:mu
#:th)
(:export #:read-fashion-train-images
#:read-fashion-train-labes
#:read-fashion-t10k-images
#:read-fashion-t10k-labels
#:read-fashion-dat... | 4,283 | Common Lisp | .lisp | 91 | 38.681319 | 94 | 0.601723 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 2899fea8316b4023546e1f5d307cd7465a789fab2b0de6009809c6ccb8ff374e | 3,169 | [
-1
] |
3,170 | exdata.lisp | chunsj_TH/db/exdata.lisp | (defpackage :th.ex.data
(:use #:common-lisp
#:mu
#:th)
(:export #:text-lines
#:ptb
#:addition
#:date-data
#:eng-fra-small
#:eng-fra-small-processed
#:iris))
(in-package :th.ex.data)
(defun data-filename (name)
($concat (namestring... | 2,241 | Common Lisp | .lisp | 49 | 34.530612 | 93 | 0.517841 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 0f12276bf6dff8b1bbb838b5d9de2585a95983240ccee5cff6cecdf64214517a | 3,170 | [
-1
] |
3,171 | celeba.lisp | chunsj_TH/db/celeba.lisp | (declaim (optimize (speed 3) (debug 0) (safety 0)))
(defpackage :th.db.celeba
(:use #:common-lisp
#:mu
#:th)
(:export #:read-celeba64-data))
(in-package :th.db.celeba)
(defparameter +celeba-location+ ($concat (namestring (user-homedir-pathname)) ".th/datasets/celeba"))
(defun read-celeba64-tenso... | 1,146 | Common Lisp | .lisp | 26 | 34.461538 | 101 | 0.558744 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 63fa28a0fe15424777cae012de77a5eb941b7aec6cf4ce399abf46381918072a | 3,171 | [
-1
] |
3,172 | mnist-original.lisp | chunsj_TH/db/mnist-original.lisp | (declaim (optimize (speed 3) (debug 1) (safety 0)))
(defpackage :th.db.mnist-original
(:use #:common-lisp
#:mu
#:th)
(:export #:read-mnist-train-images
#:read-mnist-train-labels
#:read-mnist-t10k-images
#:read-mnist-t10k-labels
#:read-mnist-data))
(in-pa... | 4,173 | Common Lisp | .lisp | 90 | 38.488889 | 99 | 0.60408 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 00b45bc47c34835f089182c51f2ae188b82725c0769f7c6153f13b525c58dbe7 | 3,172 | [
-1
] |
3,173 | layers.lisp | chunsj_TH/layers/layers.lisp | (declaim (optimize (speed 3) (debug 1) (safety 0)))
(defpackage :th.layers
(:use #:common-lisp
#:mu
#:th)
(:export #:layer
#:$execute
#:$evaluate
#:$train-parameters
#:$save-weights
#:$load-weights
#:sequential-layer
#:par... | 48,803 | Common Lisp | .lisp | 1,133 | 31.842012 | 97 | 0.531178 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | de3b99ed9b1bcd06c8d20f6de948057cbd67631761b2a767cc31dc4ae5bd3095 | 3,173 | [
-1
] |
3,174 | binadd.lisp | chunsj_TH/examples/binary-add/binadd.lisp | (defpackage :binary-add
(:use #:common-lisp
#:mu
#:th))
(in-package :binary-add)
(defparameter *binary-dim* 8)
(defparameter *int2binary* #{})
(defun dec->bin (n)
(multiple-value-bind (r m) (floor n 2)
(if (= n 0) nil (append (dec->bin r) (list m)))))
(defun bin->dec (binary) (reduce (lambda... | 5,283 | Common Lisp | .lisp | 115 | 36.582609 | 89 | 0.520373 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | dc35f8daec86a591aa58c0c41d6a42f3a8848fe56c0e29c443c1006f76d4381e | 3,174 | [
-1
] |
3,175 | squeezenet11.lisp | chunsj_TH/examples/pretrained/squeezenet11.lisp | (defpackage :squeezenet11-example
(:use #:common-lisp
#:mu
#:th
#:th.m.squeezenet11
#:th.m.imagenet
#:th.image))
(in-package :squeezenet11-example)
;; load weights - takes some time
(defparameter *squeezenet11-weights* (read-squeezenet11-weights))
(defparameter *squeezenet11-... | 1,256 | Common Lisp | .lisp | 27 | 42.296296 | 86 | 0.701554 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 5dc658d1f1dd19403c38d0e24acc4c290c8892d198af748b920dd12681886d8d | 3,175 | [
-1
] |
3,176 | vgg16.lisp | chunsj_TH/examples/pretrained/vgg16.lisp | (defpackage :vgg16-example
(:use #:common-lisp
#:mu
#:th
#:th.m.vgg16
#:th.m.imagenet
#:th.image))
(in-package :vgg16-example)
;; load weights - takes some time
(defparameter *vgg16-weights* (read-vgg16-weights))
(defparameter *vgg16-function* (vgg16 :all *vgg16-weights*))
;... | 1,128 | Common Lisp | .lisp | 27 | 37.555556 | 86 | 0.66484 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 7eb750aa92c6f212622eedad3957f69e0e9777a35553fcea80e553b522ee598e | 3,176 | [
-1
] |
3,177 | resnet101.lisp | chunsj_TH/examples/pretrained/resnet101.lisp | (defpackage :resnet101-example
(:use #:common-lisp
#:mu
#:th
#:th.m.resnet101
#:th.m.imagenet
#:th.image))
(in-package :resnet101-example)
;; load weights - takes some time
(defparameter *resnet101-weights* (read-resnet101-weights))
(defparameter *resnet101-function* (resnet1... | 2,101 | Common Lisp | .lisp | 45 | 41.155556 | 86 | 0.652683 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 41049daab41fe2f6454f28ce34e2d31c7b25a9da15c1900548d2e5dcd10a1e67 | 3,177 | [
-1
] |
3,178 | vgg19.lisp | chunsj_TH/examples/pretrained/vgg19.lisp | (defpackage :vgg19-example
(:use #:common-lisp
#:mu
#:th
#:th.m.vgg19
#:th.m.imagenet
#:th.image))
(in-package :vgg19-example)
;; load weights - takes some time
(defparameter *vgg19-weights* (read-vgg19-weights))
(defparameter *vgg19-function* (vgg19 :all *vgg19-weights*))
;... | 1,140 | Common Lisp | .lisp | 27 | 38 | 86 | 0.668473 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 765bf038ca7e24757b8c9768e965286859e51780ac8079de9eed09598f8e4a79 | 3,178 | [
-1
] |
3,179 | resnet50.lisp | chunsj_TH/examples/pretrained/resnet50.lisp | (defpackage :resnet50-example
(:use #:common-lisp
#:mu
#:th
#:th.m.resnet50
#:th.m.imagenet
#:th.image))
(in-package :resnet50-example)
;; load weights - takes some time
(defparameter *resnet50-weights* (read-resnet50-weights))
(defparameter *resnet50-function* (resnet50 :all... | 1,188 | Common Lisp | .lisp | 27 | 39.777778 | 86 | 0.679654 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | edfbc15756f77591d980b5b54456f8d4d93bb672ceda4637a738aec07d5ebfd7 | 3,179 | [
-1
] |
3,180 | densenet161.lisp | chunsj_TH/examples/pretrained/densenet161.lisp | (defpackage :densenet161-example
(:use #:common-lisp
#:mu
#:th
#:th.m.densenet161
#:th.m.imagenet
#:th.image))
(in-package :densenet161-example)
;; load weights - takes some time
(defparameter *densenet161-weights* (read-densenet161-weights))
(defparameter *densenet161-functi... | 1,242 | Common Lisp | .lisp | 27 | 41.777778 | 86 | 0.696443 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 77f81c238ca86b77248573ff96d305186996d0a2a52ab552146d5d7f23ab2c61 | 3,180 | [
-1
] |
3,181 | fcn.lisp | chunsj_TH/examples/pretrained/fcn.lisp | (defpackage :fcn-models
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.m.imagenet
#:th.m.vgg16
#:th.m.vgg19
#:th.m.resnet50
#:th.m.densenet161
#:th.m.squeezenet11))
(in-package :fcn-models)
(defun cats (f)
(let* ((rgb1 (tensor-from-png-file "d... | 1,095 | Common Lisp | .lisp | 41 | 21.04878 | 60 | 0.580707 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | ff6b31681cb7ab3abe8813e6eb0fdad195bf1979bdae34e50d8d2a3bc623fbfd | 3,181 | [
-1
] |
3,182 | resnet152.lisp | chunsj_TH/examples/pretrained/resnet152.lisp | (defpackage :resnet152-example
(:use #:common-lisp
#:mu
#:th
#:th.m.resnet152
#:th.m.imagenet
#:th.image))
(in-package :resnet152-example)
;; load weights - takes some time
(defparameter *resnet152-weights* (read-resnet152-weights))
(defparameter *resnet152-function* (resnet1... | 1,207 | Common Lisp | .lisp | 27 | 40.481481 | 86 | 0.684838 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 746df07d65bbab658de80fdb5a8bfa290ae45fb6ceddb9b53de26e97b3c4ce40 | 3,182 | [
-1
] |
3,183 | rbm.lisp | chunsj_TH/examples/etc/rbm.lisp | ;; from
;; https://github.com/odie2630463/Restricted-Boltzmann-Machines-in-pytorch
(defpackage :rbm
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :rbm)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data h... | 3,402 | Common Lisp | .lisp | 94 | 29.329787 | 89 | 0.542935 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 536ab7af33069e06138f611fa1e1ae672e89fe0ee0ac5fc5c40a3e0c1913b932 | 3,183 | [
-1
] |
3,184 | sentiment.lisp | chunsj_TH/examples/etc/sentiment.lisp | (defpackage :sentiment-example
(:use #:common-lisp
#:mu
#:th
#:th.db.imdb))
(in-package :sentiment-example)
;; read imdb review data (from udacity course)
(defparameter *imdb* (read-imdb-data2))
;; each line of imdb reviews data is a review corresponding to each label in labels.
;; we need ... | 8,083 | Common Lisp | .lisp | 179 | 33.312849 | 247 | 0.50146 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 9fe546e14c2e6dda10f50be10afcd3ab4d893924e5be4771b7d134549fc310fa | 3,184 | [
-1
] |
3,185 | hmm.lisp | chunsj_TH/examples/etc/hmm.lisp | (defpackage :hmm-simple
(:use #:common-lisp
#:mu
#:th))
(in-package :hmm-simple)
(defclass hmm ()
((n :accessor state-counts)
(p0 :accessor initial-state-probabilities)
(tm :accessor transition-matrix)
(em :accessor emission-matrix)))
(defun get-emission (hmm iobs)
(let ((nr ($size (em... | 2,953 | Common Lisp | .lisp | 63 | 41.587302 | 88 | 0.643379 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 2741504b13d97381f31f403d0c26ade5589ba3cdc30461af24292453d2be8b66 | 3,185 | [
-1
] |
3,186 | chal.lisp | chunsj_TH/examples/pp/chal.lisp | (defpackage :challenger-accident
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :challenger-accident)
(defparameter *data* (->> (slurp "./data/challenger.csv")
(cdr)
(mapcar (lambda (line)
(let ((ss ... | 1,881 | Common Lisp | .lisp | 41 | 36.341463 | 87 | 0.565574 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | d018e465c4359dd321ae5548984b524c5ed792a44bdcf7ff508ae5f2664b5663 | 3,186 | [
-1
] |
3,187 | em-exam.lisp | chunsj_TH/examples/pp/em-exam.lisp | (defpackage :em-example
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :em-example)
(defparameter *ts* nil)
(defun p (p1 p2 &optional (m 0.5))
(if (< (random 1.0) m)
(max p1 p2)
(min p1 p2)))
;;
;; PROBLEM 1.
;;
;; we have a fair coin. flip it and if it shows head, then ... | 2,055 | Common Lisp | .lisp | 56 | 31.696429 | 85 | 0.585808 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 8450141f0629ec6fff67918854eed7d5e919e265ea9c17d651fbb6731e5be11e | 3,187 | [
-1
] |
3,188 | mixture.lisp | chunsj_TH/examples/pp/mixture.lisp | (defpackage :mixture
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :mixture)
(defparameter *data* (->> (slurp "data/mixture.csv")
(mapcar (lambda (f) (parse-float f)))
(tensor)))
(defun posterior (p s0 s1 c0 c1)
(let ((p-prior (sco... | 1,555 | Common Lisp | .lisp | 32 | 33.6875 | 89 | 0.480237 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | c6421b24307ed0e8953392318eb32fcd5427b3015c16732848674af9c5924ca9 | 3,188 | [
-1
] |
3,189 | bin.lisp | chunsj_TH/examples/pp/bin.lisp | (defpackage :infer-binomial
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :infer-binomial)
(defvar *flips* (tensor '(1 1 1 1 1 1 1 1 1 1 1 0 0 0)))
(defun binomial-posterior (theta)
(let ((prior-theta (score/beta theta 1 1)))
(when prior-theta
(let ((likelihood-flips (scor... | 500 | Common Lisp | .lisp | 15 | 28.2 | 63 | 0.615385 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 630b62cc3ed898b2cea254f064fad40de53e64752c30e7f72a91348d22ef0d78 | 3,189 | [
-1
] |
3,190 | pp-sms.lisp | chunsj_TH/examples/pp/pp-sms.lisp | (defpackage :pp-sms
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :pp-sms)
(defparameter *sms* (->> (slurp "./data/sms.txt")
(mapcar #'parse-float)
(mapcar #'round)
(tensor)))
(defparameter *mean* ($mean *sms*)... | 4,460 | Common Lisp | .lisp | 98 | 35.816327 | 90 | 0.559006 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | d23411be4540bd1d402ae4229382dd0d30da55e12db4d9526eaf0af180538993 | 3,190 | [
-1
] |
3,191 | pp-disaster.lisp | chunsj_TH/examples/pp/pp-disaster.lisp | (defpackage :pp-disaster
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :pp-disaster)
;; mining disaster problem
(defparameter *disasters* (tensor
'(4 5 4 0 1 4 3 4 0 6 3 3 4 0 2 6
3 3 5 4 5 3 1 4 4 1 5 5 3 4 2 5
... | 2,091 | Common Lisp | .lisp | 49 | 32.265306 | 95 | 0.54179 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 33e3f6b67218cf6b0b5c3004d0f90fa201c0d35de2a69d44fc22d984574890ce | 3,191 | [
-1
] |
3,192 | vi.lisp | chunsj_TH/examples/pp/vi.lisp | ;; https://www.ritchievink.com/blog/2019/09/16/variational-inference-from-scratch/
(defpackage :vi-learn
(:use #:common-lisp
#:mu
#:th
#:th.layers))
(in-package :vi-learn)
(defun generate-dataset (&optional (n 150))
(let ((xmin -20)
(xmax 60)
(w0 0.125)
(b0 5))
... | 9,229 | Common Lisp | .lisp | 221 | 31.167421 | 93 | 0.496879 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | b34fa5f1d90aeaf6f26fcdf9e23360c159c35651ec53722841dcc4f15c936fc9 | 3,192 | [
-1
] |
3,193 | simple-mh.lisp | chunsj_TH/examples/pp/simple-mh.lisp | (defpackage :simple-mh
(:use #:common-lisp
#:mu
#:th
#:mplot))
(in-package :simple-mh)
;; PROBLEM DESCRIPTION
;;
;; estimate standard deviation of population using partial observations.
;; of course, this case should have analytic solution but i like to apply
;; markov chain monte caro, or m... | 4,195 | Common Lisp | .lisp | 94 | 34.223404 | 92 | 0.575031 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | bd7b6df138477f9b5c6da5ee74d077eb35b13b3da2b4444bdc5bbf389a88487e | 3,193 | [
-1
] |
3,194 | linreg.lisp | chunsj_TH/examples/pp/linreg.lisp | (defpackage :linear-regression
(:use #:common-lisp
#:mu
#:th
#:th.pp))
(in-package :linear-regression)
(defparameter *xs* (tensor (loop :for i :from 1 :to 200 :collect i)))
(defparameter *ys* ($+ ($normal (tensor ($count *xs*)) 0 1) ($* 2 *xs*)))
(defun lr-posterior (b0 b1 s)
(let ((prior... | 688 | Common Lisp | .lisp | 18 | 32.888889 | 73 | 0.564565 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | f1eca80d5ef930d40b74b22775bab94eea0d8b736b19bf5b10199e4a2eec75f7 | 3,194 | [
-1
] |
3,195 | xor.lisp | chunsj_TH/examples/simple/xor.lisp | (defpackage :xor-example
(:use #:common-lisp
#:mu
#:th))
(in-package :xor-example)
;; because there's no complete neural network library without xor example
;; direct, without using ad.
(defun fwd (input weight) ($sigmoid! ($@ input weight)))
(defun dwb (delta output) ($* delta output ($- 1 output)... | 5,587 | Common Lisp | .lisp | 153 | 25.921569 | 73 | 0.394392 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 4d1bca886b8618d2be3b2abf6f30617736f93f3e359aac8df4b3fbfb2f58b216 | 3,195 | [
-1
] |
3,196 | catsdogs.lisp | chunsj_TH/examples/simple/catsdogs.lisp | ;; note that this examples is for testing cnn on color images.
;; to get better result, you have to define better network and more data.
;; this example, as is provided, will have 31~40% of error rates.
(defpackage :cats-and-dogs
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.image
... | 5,139 | Common Lisp | .lisp | 107 | 33.971963 | 96 | 0.495014 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | fd0d7568e440fb38a899a8e644e5ad6851869a7d3d9f4d04711c10dbad24d0a2 | 3,196 | [
-1
] |
3,197 | mnist.lisp | chunsj_TH/examples/simple/mnist.lisp | (defpackage :mnist-example
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :mnist-example)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has following dataset
;; train-images, train-labels and test-images, test-labels
(pr... | 5,702 | Common Lisp | .lisp | 133 | 34.789474 | 87 | 0.574338 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | c7f7f14f89cd7af0971a4af8f89996b4fd4ce4a288a8749800bea00650e5be78 | 3,197 | [
-1
] |
3,198 | layer.lisp | chunsj_TH/examples/simple/layer.lisp | (defpackage :layer-example
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist
#:th.layers))
(in-package :layer-example)
;; this example will use layers to re-create the mnist classification
;; example using 2D convolutional network.
;; personally, i do not like this kind of approach/design ... | 4,755 | Common Lisp | .lisp | 102 | 34.696078 | 93 | 0.543042 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 405067ce11d6f1ca381a677ef267f204fab1805027eefc46c914c117db6fd2f8 | 3,198 | [
-1
] |
3,199 | bn.lisp | chunsj_TH/examples/simple/bn.lisp | (defpackage :bn
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.db.mnist
#:th.db.fashion))
(in-package :bn)
;; use one of following
(defparameter *mnist* (read-mnist-data))
(defparameter *mnist* (read-fashion-data))
(defparameter *data-size* 1000)
(defparameter *x-train* ($i... | 5,904 | Common Lisp | .lisp | 114 | 30.95614 | 87 | 0.450987 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 143b6b13736444a66f5876ae678725e31f2ddd2ed14fa0e107a179852aa01333 | 3,199 | [
-1
] |
3,200 | ch3.lisp | chunsj_TH/examples/books/dlfs2/ch3.lisp | (defpackage :dlfs-ch3
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.text))
(in-package :dlfs-ch3)
(let* ((c (tensor '((1 0 0 0 0 0 1))))
(c2 ($select ($nonzero c) 1 1))
(w (rndn 7 3)))
(prn ($@ c w))
(prn ($wimb c2 w))
(prn ($wemb c w)))
(let ((c0 (tensor '((1 ... | 3,929 | Common Lisp | .lisp | 93 | 34.903226 | 98 | 0.532617 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | cfd0dcbfe86d35d08a3b01236a407c889f21dbe76efae0ba1073c8084a1affb6 | 3,200 | [
-1
] |
3,201 | ch7.lisp | chunsj_TH/examples/books/dlfs2/ch7.lisp | (defpackage :dlfs2-ch7
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.layers
#:th.text))
(in-package :dlfs2-ch7)
;; data for the chapter 7 example
;;
;; number addition problems
(defparameter *data* (addition))
(defparameter *data-length* ($count *data*))
(defparameter *enco... | 7,877 | Common Lisp | .lisp | 157 | 38.019108 | 96 | 0.557837 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 0922c1a5c8eaf3c2eaf8b338c9b25e56741d72dc550a25e1074796ac271623de | 3,201 | [
-1
] |
3,202 | ch8.lisp | chunsj_TH/examples/books/dlfs2/ch8.lisp | (defpackage :dlfs2-ch8
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.layers
#:th.text))
(in-package :dlfs2-ch8)
;; data for the chapter 8 example
;;
;; number addition problems
(defparameter *data* (date-data))
(defparameter *data-length* ($count *data*))
(defparameter *enc... | 8,449 | Common Lisp | .lisp | 163 | 37.067485 | 96 | 0.521244 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 84428149b8e3f81dd90d174e3af337edc2c6eb09ebc9a220afec68473c2c26ba | 3,202 | [
-1
] |
3,203 | ch6.lisp | chunsj_TH/examples/books/dlfs2/ch6.lisp | (defpackage :dlfs2-ch6
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.layers
#:th.text))
(in-package :dlfs2-ch6)
(defparameter *simple-data* '("you" "say" "goodbye" "I" "say" "hello" "."))
(defparameter *encoder* (word-encoder *simple-data*))
(prn (encoder-encode *encoder* ... | 4,082 | Common Lisp | .lisp | 85 | 38.105882 | 94 | 0.538481 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 27785258238dee83ad439ed53d9214b770db224e98db12daed6c505e0e487ad1 | 3,203 | [
-1
] |
3,204 | ch4.lisp | chunsj_TH/examples/books/dlfs2/ch4.lisp | (defpackage :dlfs2-ch4
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.text))
(in-package :dlfs2-ch4)
;; choice
(prn (loop :for i :from 0 :below 20 :collect ($choice '(:a :b :c) '(0.1 0.2 0.7))))
(defun wimb (x w)
(cond ((atom (car x)) ($wimb x w))
((listp (car x)) (apply ... | 1,660 | Common Lisp | .lisp | 46 | 29.73913 | 93 | 0.493142 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | a2e77a8270c630e6638c6e0fdabd7b37106b6d1029be9991fbfd5367759628d4 | 3,204 | [
-1
] |
3,205 | ch5.lisp | chunsj_TH/examples/books/dlfs2/ch5.lisp | (defpackage :dlfs2-ch5
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.layers
#:th.text))
(in-package :dlfs2-ch5)
(defparameter *simple-data* '("you" "say" "goodbye" "I" "say" "hello" "."))
(defparameter *encoder* (word-encoder *simple-data*))
(prn (encoder-encode *encoder* ... | 3,961 | Common Lisp | .lisp | 83 | 37.60241 | 94 | 0.531104 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 1fbe5284af2f9d327820b726a57b08b8366429bc8c5750d50802a987e22b5dc5 | 3,205 | [
-1
] |
3,206 | ch06.lisp | chunsj_TH/examples/books/gdl/ch06.lisp | (defpackage :gdl-ch06
(:use #:common-lisp
#:mu
#:th))
(in-package :gdl-ch06)
(defparameter *streetlights* (tensor '((1 0 1)
(0 1 1)
(0 0 1)
(1 1 1)
... | 3,753 | Common Lisp | .lisp | 79 | 33.050633 | 89 | 0.457923 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 7dc8758cac33c03b7dff59eb1dd9761c12a23f52d0607a0230db830740a52e21 | 3,206 | [
-1
] |
3,207 | ch11.lisp | chunsj_TH/examples/books/gdl/ch11.lisp | (ql:quickload :cl-ppcre)
(defpackage :gdl-ch11
(:use #:common-lisp
#:mu
#:th
#:th.db.imdb))
(in-package :gdl-ch11)
;; onehots
(defparameter *onehots* #{})
(setf ($ *onehots* "cat") (tensor '(1 0 0 0)))
(setf ($ *onehots* "the") (tensor '(0 1 0 0)))
(setf ($ *onehots* "dog") (tensor '(0 0 1... | 7,242 | Common Lisp | .lisp | 158 | 35.35443 | 247 | 0.516088 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 23928c518d0ce7f1fd910ff5b64a4d5c1de4c05fe41552e88a786a4e673b756d | 3,207 | [
-1
] |
3,208 | ch03.lisp | chunsj_TH/examples/books/gdl/ch03.lisp | (defpackage :gdl-ch03
(:use #:common-lisp
#:mu
#:th))
(in-package :gdl-ch03)
;; simple neural network
(defun neural-network (input weight)
(* input weight))
(defparameter *number-of-toes* '(8.5 9.5 10 9))
(let ((weight 0.1))
(prn (neural-network ($ *number-of-toes* 0) weight)))
;; multiple in... | 1,932 | Common Lisp | .lisp | 55 | 26.218182 | 68 | 0.495974 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 0c9a145e5c9732d98855e6c0b2f83899d99115f3dbd9d5f6602d0d5d10ce9d9a | 3,208 | [
-1
] |
3,209 | ch11-2.lisp | chunsj_TH/examples/books/gdl/ch11-2.lisp | (ql:quickload :cl-ppcre)
(defpackage :gdl-ch11-2
(:use #:common-lisp
#:mu
#:th
#:th.db.imdb))
(in-package :gdl-ch11-2)
(defun process-review (review)
(remove-duplicates (->> (split #\space review)
(mapcar (lambda (w)
(cl-ppcre:... | 11,959 | Common Lisp | .lisp | 249 | 35.144578 | 247 | 0.487234 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 91fb3b753f09865d6067210f98961568d62bfe9a6b8d92f5f8a7d12a5f35db39 | 3,209 | [
-1
] |
3,210 | ch08.lisp | chunsj_TH/examples/books/gdl/ch08.lisp | (defpackage :gdl-ch08
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :gdl-ch08)
;; use smaller dataset for speed
(defun smaller-mnist-data ()
(let ((train-images (tensor))
(train-labels (tensor))
(test-images (tensor))
(test-labels (tensor)))
(let ((f... | 4,852 | Common Lisp | .lisp | 107 | 36.775701 | 95 | 0.544743 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 31ae672842b40cb88f16b9b750729a5294f8d3ffd120614b366a6e0dcf627cf2 | 3,210 | [
-1
] |
3,211 | ch04.lisp | chunsj_TH/examples/books/gdl/ch04.lisp | (defpackage :gdl-ch04
(:use #:common-lisp
#:mu
#:th))
(in-package :gdl-ch04)
;; error
(let ((knob-weight 0.5)
(input 0.5)
(goal-pred 0.8))
(let* ((pred (* input knob-weight))
(err (expt (- pred goal-pred) 2)))
(prn err)))
;; simplest form of neural learning
(let ((weight ... | 2,310 | Common Lisp | .lisp | 62 | 29.887097 | 73 | 0.53908 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | a8cbfd629e496567c67f1ba98b07f768bdbc3eabd96c415c1c0aa0476dd478af | 3,211 | [
-1
] |
3,212 | ch06.lisp | chunsj_TH/examples/books/gdrl/ch06.lisp | (defpackage :gdrl-ch06
(:use #:common-lisp
#:mu
#:th
#:th.env)
(:import-from #:th.env.examples))
(in-package :gdrl-ch06)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
(rem-steps (- m... | 16,680 | Common Lisp | .lisp | 331 | 35.652568 | 94 | 0.494089 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 8b169fd65faa372af3bc2c95c3831df8073d183e9f1b895fe3a6305af0e615f0 | 3,212 | [
-1
] |
3,213 | ch11.lisp | chunsj_TH/examples/books/gdrl/ch11.lisp | (defpackage :gdrl-ch11
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :gdrl-ch11)
(defun train-env (&optional (max-steps 300)) (cartpole-env :easy :reward max-steps))
(defun eval-env () (cartpole-env :eval))
(defun clamp-probs (probs)
($... | 26,557 | Common Lisp | .lisp | 621 | 26.478261 | 98 | 0.433649 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 17e08b1740766c2f967a2077e157cf66c943049419cc1293fb9ab33c94cb6676 | 3,213 | [
-1
] |
3,214 | ch03.lisp | chunsj_TH/examples/books/gdrl/ch03.lisp | (defpackage :gdrl-ch03
(:use #:common-lisp
#:mu
#:th
#:th.env)
(:import-from #:th.env.examples))
(in-package :gdrl-ch03)
(let* ((env (th.env.examples:slippery-walk-five-env))
(policy (lambda (s) ($ '(0 0 0 0 0 0 0) s))))
(env/print-policy env policy :action-symbols '("<" ">") :nco... | 6,829 | Common Lisp | .lisp | 138 | 40.137681 | 77 | 0.598382 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 60bfe5b6ce5a0ba0269a32c1709cc474990c7772cfa68fe266c63c25accaaff4 | 3,214 | [
-1
] |
3,215 | ch12.lisp | chunsj_TH/examples/books/gdrl/ch12.lisp | (defpackage :gdrl-ch12
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole
#:th.env.pendulum))
(in-package :gdrl-ch12)
(defparameter *max-action* 2)
(defun actor-model (&optional (ni 3) (no 1))
(let ((h 16)
(max-action *max-action*))
(s... | 5,879 | Common Lisp | .lisp | 154 | 27.909091 | 89 | 0.501751 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 03d7fb0cce5044bc313794b3c947b3bb0c38b313a4e6aa9035b24bee9e66cf56 | 3,215 | [
-1
] |
3,216 | ch09.lisp | chunsj_TH/examples/books/gdrl/ch09.lisp | (defpackage :gdrl-ch09
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :gdrl-ch09)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
(rem... | 7,809 | Common Lisp | .lisp | 173 | 31.098266 | 95 | 0.488451 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 1d9bbc1923b5e54fdf36a6c2519fd96afd1c40380cfc8920a547da842023eb1f | 3,216 | [
-1
] |
3,217 | ch05.lisp | chunsj_TH/examples/books/gdrl/ch05.lisp | (defpackage :gdrl-ch05
(:use #:common-lisp
#:mu
#:mplot
#:th
#:th.env)
(:import-from #:th.env.examples))
(in-package :gdrl-ch05)
(let* ((env (th.env.examples:random-walk-env))
(goal 6)
(policy (lambda (s) ($ '(0 0 0 0 0 0 0) s)))
(v-true (env/policy-evaluation ... | 17,066 | Common Lisp | .lisp | 323 | 36.464396 | 99 | 0.484656 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 6283e1da0927cf9b52dd9659b29a6e68e445f417adc3510d04fb8ab154687453 | 3,217 | [
-1
] |
3,218 | ch08.lisp | chunsj_TH/examples/books/gdrl/ch08.lisp | (defpackage :gdrl-ch08
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.examples))
(in-package :gdrl-ch08)
(defun fcq (input-dim output-dim)
(let ((h1 5)
(h2 5))
(sequential-layer
(affine-layer input-dim h1 :activation :tanh)
(affine-layer h... | 16,796 | Common Lisp | .lisp | 368 | 31.230978 | 95 | 0.472769 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | be72c0cd3def8702f46f286ab8ade06a9db61d8674b6ad7d0ec73ff4cd69f05d | 3,218 | [
-1
] |
3,219 | ch07.lisp | chunsj_TH/examples/books/gdrl/ch07.lisp | (defpackage :gdrl-ch07
(:use #:common-lisp
#:mu
#:th
#:th.env)
(:import-from #:th.env.examples))
(in-package :gdrl-ch07)
(let* ((env (th.env.examples:slippery-walk-seven-env))
(optres (env/value-iteration env :gamma 0.99D0))
(opt-v (value-iteration/optimal-value-function optr... | 16,393 | Common Lisp | .lisp | 302 | 34.586093 | 99 | 0.438985 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 26a240bc5287633ee3f639606b47609e7f29d7622b4c84a3ba51afd9e55592fa | 3,219 | [
-1
] |
3,220 | ch10.lisp | chunsj_TH/examples/books/gdrl/ch10.lisp | (defpackage :gdrl-ch10
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :gdrl-ch10)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
(rem... | 8,239 | Common Lisp | .lisp | 197 | 32.426396 | 91 | 0.54922 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 85bfd83ea20f665b696764ace5a3ceedaf00312c853f9d24bdebd1477de3df35 | 3,220 | [
-1
] |
3,221 | ch04.lisp | chunsj_TH/examples/books/gdrl/ch04.lisp | (defpackage :gdrl-ch04
(:use #:common-lisp
#:mu
#:mplot
#:th
#:th.env)
(:import-from #:th.env.bandits))
(in-package :gdrl-ch04)
(defun run-episodes (env &key (name "STRATEGY NAME") strategy initq initn (nepisodes 1000))
(let ((q (zeros (env/action-count env)))
(n (tensor.... | 14,969 | Common Lisp | .lisp | 286 | 33.730769 | 101 | 0.463423 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | a4400f2b965bd4b6b3b306070093c1aa8e5b53e1635d9cd7c08197420ba7e209 | 3,221 | [
-1
] |
3,222 | dlfs06.lisp | chunsj_TH/examples/books/dlfs/dlfs06.lisp | (defpackage :dlfs-06
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :dlfs-06)
;; mnist data loading - takes time, so load and set
(defparameter *mnist* (read-mnist-data))
(prn *mnist*)
(defparameter *mnist-train-image-batches*
(loop :for i :from 0 :below 6
:for rng = (l... | 14,929 | Common Lisp | .lisp | 407 | 27.651106 | 84 | 0.471267 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 1c4f6b4656856b06924fca397ccce13678bfdcd91fe096d2acf30f78b3813e08 | 3,222 | [
-1
] |
3,223 | dlfs02.lisp | chunsj_TH/examples/books/dlfs/dlfs02.lisp | (defpackage :dlfs-02
(:use #:common-lisp
#:mu
#:th))
(in-package :dlfs-02)
(defun and-gate (x1 x2)
(let ((w1 0.5)
(w2 0.5)
(theta 0.7))
(let ((tmp (+ (* x1 w1) (* x2 w2))))
(cond ((<= tmp theta) 0)
((> tmp theta) 1)))))
(prn (and-gate 0 0))
(prn (and-gate 1 0... | 1,349 | Common Lisp | .lisp | 54 | 20.888889 | 40 | 0.481308 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 0bf8f2dda7a067f7461d51607671d3b5b340cffb89c83b742fdc533cfc6e12a0 | 3,223 | [
-1
] |
3,224 | dlfs01.lisp | chunsj_TH/examples/books/dlfs/dlfs01.lisp | (defpackage :dlfs-01
(:use #:common-lisp
#:mu
#:th))
(in-package :dlfs-01)
;; creating tensor
(let ((x (tensor '(1 2 3))))
(prn x)
(prn (type-of x)))
;; generic operations
(let ((x (tensor '(1 2 3)))
(y (tensor '(2 4 6))))
(prn ($+ x y))
(prn ($- x y))
(prn ($* x y))
(prn ($/ x y)... | 1,533 | Common Lisp | .lisp | 58 | 23.155172 | 75 | 0.494198 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | aa1af1a457ace3a11d79a491a02ba7dd13c5a530bcf24c64d18a90131e6b77ea | 3,224 | [
-1
] |
3,225 | dlfs07.lisp | chunsj_TH/examples/books/dlfs/dlfs07.lisp | (defpackage :dlfs-07
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :dlfs-07)
;; prepare data for later use, it takes some time to load
(defparameter *mnist* (read-mnist-data))
(prn *mnist*)
(defparameter *mnist-train-image-batches*
(loop :for i :from 0 :below 60
:for r... | 8,779 | Common Lisp | .lisp | 242 | 28.024793 | 87 | 0.514917 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | b91fc202e9252df4ce6da9a55e1e26b7be8e09bfd06758e4c7e9557492cb76f6 | 3,225 | [
-1
] |
3,226 | dlfs04.lisp | chunsj_TH/examples/books/dlfs/dlfs04.lisp | (defpackage :dlfs-04
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :dlfs-04)
;; mnist data loading - takes time, so load and set
(defparameter *mnist* (read-mnist-data))
(prn *mnist*)
;; network parameters
(defparameter *w1* ($parameter (rndn 784 50)))
(defparameter *b1* ($param... | 2,371 | Common Lisp | .lisp | 80 | 25.2375 | 63 | 0.540079 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | f44ff2ed07069bd79d577371f62d92f1f2c2686ce6030c8803222f07833b6637 | 3,226 | [
-1
] |
3,227 | dlfs03.lisp | chunsj_TH/examples/books/dlfs/dlfs03.lisp | (defpackage :dlfs-03
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :dlfs-03)
;; sigmoid function
(prn ($sigmoid 0))
;; step function
(defun step-function (x)
(if ($tensorp x)
(tensor ($gt x 0))
($gt x 0)))
;; testing step-function
(let ((x (tensor '(-1 1 2))))
(... | 4,130 | Common Lisp | .lisp | 155 | 22.825806 | 66 | 0.512022 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 38738eba49558c0e267cdca00db0b4f48163485ffcbd1e3c94f2a6ee0faf04a7 | 3,227 | [
-1
] |
3,228 | dlfs05.lisp | chunsj_TH/examples/books/dlfs/dlfs05.lisp | (defpackage :dlfs-05
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :dlfs-05)
;; mnist data loading - takes time, so load and set
(defparameter *mnist* (read-mnist-data))
(prn *mnist*)
;; network parameters
(defparameter *w1* ($parameter (rndn 784 50)))
(defparameter *b1* ($param... | 3,543 | Common Lisp | .lisp | 96 | 28.833333 | 68 | 0.528401 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 3b1762c34b8adee963a33d228aae1287863dbc3c6daa8a886941cc1183360aa2 | 3,228 | [
-1
] |
3,229 | tensor.lisp | chunsj_TH/examples/intro/tensor.lisp | (defpackage th.tensor-examples
(:use #:common-lisp
#:mu
#:th))
(in-package :th.tensor-examples)
;; plain storage
(prn (storage.float))
;; creates an empty tensor of default tensor class (float)
(prn (tensor))
;; creates a tensor of default tensor class type with specified sizes;
;; elements are no... | 29,324 | Common Lisp | .lisp | 1,046 | 23.808795 | 96 | 0.500124 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 915c415e1a1af0dfce3a72823341124fe1d4806ff2828bb6c373bc011e681851 | 3,229 | [
-1
] |
3,230 | conv.lisp | chunsj_TH/examples/intro/conv.lisp | (defpackage :conv
(:use #:common-lisp
#:mu
#:th))
(in-package :conv)
;; some basic test on convolution
(let ((x (rnd 100 100))
(k (rnd 10 10)))
(prn ($size ($conv2 x k)))
(prn ($size ($conv2 x k :full))))
(let ((x (rnd 50 100 100))
(k (rnd 50 10 10)))
(prn ($size ($conv2 x k)))
... | 10,925 | Common Lisp | .lisp | 295 | 27.132203 | 97 | 0.387821 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 4d5ca73af5e86500945d096bc4790e571cfa794245b0e4efb2b78aeac1be8e14 | 3,230 | [
-1
] |
3,231 | file.lisp | chunsj_TH/examples/intro/file.lisp | (defpackage th.file-examples
(:use #:common-lisp
#:mu
#:th))
(in-package :th.file-examples)
(let ((f (file.disk "thfile.dat" "w"))
(s (storage.double '(1 2 3 4))))
($fwrite s f)
($fclose f))
(let ((f (file.disk "thfile.dat" "r"))
(s (storage.double)))
($fread s f)
($fclose f)
... | 1,288 | Common Lisp | .lisp | 54 | 20.12963 | 41 | 0.533933 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | e4e0340da411e9f984c419777abab450b227fdc003a20f76d98ba1d979fd08b6 | 3,231 | [
-1
] |
3,232 | etc.lisp | chunsj_TH/examples/intro/etc.lisp | (defpackage :etc-examples
(:use #:common-lisp
#:mu
#:th))
;; some examples from numcl project
;; https://github.com/numcl/numcl/blob/master/example.lisp
(in-package :etc-examples)
;; creation
(prn (arange 0 10))
;; reshaping
(prn ($reshape (arange 0 10) 2 5))
;; arange with negative step
(prn (ar... | 552 | Common Lisp | .lisp | 20 | 23.75 | 58 | 0.61597 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 4306073bef04dcc4d281753238cb5423b03fb8eb828347c6f9f3a4fe41ea0350 | 3,232 | [
-1
] |
3,233 | bp.lisp | chunsj_TH/examples/intro/bp.lisp | (defpackage th.ad-example
(:use #:common-lisp
#:mu
#:th))
(in-package :th.ad-example)
;; broadcast
(let* ((x ($parameter 5))
(y (tensor '(1 2 3)))
(out ($broadcast x y)))
($gs! out (tensor '(1 2 3)))
(prn ($gradient x)))
(let* ((a (tensor '(5 5 5)))
(c ($parameter 5))
... | 15,621 | Common Lisp | .lisp | 517 | 22.073501 | 67 | 0.398964 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 11e00705df677ef445f24c70dd7da144a7e308b07c7a6093a5338e1a1173fee7 | 3,233 | [
-1
] |
3,234 | dcgan2-layers.lisp | chunsj_TH/examples/gan/dcgan2-layers.lisp | ;; https://medium.com/@jonathan_hui/gan-dcgan-deep-convolutional-generative-adversarial-networks-df855c438f
(defpackage :dcgan2-layers
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.layers
#:th.db.mnist))
(in-package :dcgan2-layers)
(defun build-batches (batch-size batch-coun... | 7,749 | Common Lisp | .lisp | 147 | 33.387755 | 107 | 0.463122 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | b8dc5ef3baba7785d5b33edc48699c6ce2da87c603fc75e8567190c3b31ac850 | 3,234 | [
-1
] |
3,235 | wgan.lisp | chunsj_TH/examples/gan/wgan.lisp | ;; from
;; https://wiseodd.github.io/techblog/2017/02/04/wasserstein-gan/
(defpackage :wgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :wgan)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has foll... | 6,204 | Common Lisp | .lisp | 146 | 31.205479 | 89 | 0.500249 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | f29f2835f1363a5e6d17ec9d9729abef44e1b60c944fe37df18bc5a49fdd5a4d | 3,235 | [
-1
] |
3,236 | regan.lisp | chunsj_TH/examples/gan/regan.lisp | ;; https://ajolicoeur.wordpress.com/RelativisticGAN/
(defpackage :regan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.layers
#:th.db.mnist))
(in-package :regan)
(defun build-batches (batch-size batch-count)
(let ((mnist (read-mnist-data)))
(loop :for i :from 0 :below b... | 6,678 | Common Lisp | .lisp | 120 | 34.45 | 94 | 0.466269 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | d3b7550dec4bbf5388854ff801967c5c8868081499e6a7e79fc069be9512c412 | 3,236 | [
-1
] |
3,237 | gan2.lisp | chunsj_TH/examples/gan/gan2.lisp | ;; from
;; https://wiseodd.github.io/techblog/2017/01/20/gan-pytorch/
;; with tanh generator
(defpackage :gan2
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :gan2)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has foll... | 6,295 | Common Lisp | .lisp | 147 | 31.904762 | 97 | 0.504413 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 57415e35bdd05acfed25ae3a220c857c875de1223f7da6aced4e2d41c37946f8 | 3,237 | [
-1
] |
3,238 | lsgan.lisp | chunsj_TH/examples/gan/lsgan.lisp | ;; from
;; https://wiseodd.github.io/techblog/2017/03/02/least-squares-gan/
(defpackage :lsgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :lsgan)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has ... | 6,100 | Common Lisp | .lisp | 141 | 31.687943 | 92 | 0.495363 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | dd6bed6ecadc5a72e5efab0ae041401df7b3ef8f967faf26d2407df71c7ccc2e | 3,238 | [
-1
] |
3,239 | dcgan.lisp | chunsj_TH/examples/gan/dcgan.lisp | ;; from
;; https://github.com/soumith/dcgan.torch
;; https://towardsdatascience.com/having-fun-with-deep-convolutional-gans-f4f8393686ed
(defpackage :dcgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :dcgan)
;; load mnist data, takes ~22 secs in macbook 2017... | 7,066 | Common Lisp | .lisp | 170 | 31.582353 | 97 | 0.514049 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | c6197ac36173da67159c3678684cce7c21dfaeabaff7fe9eb12d1959f1092a95 | 3,239 | [
-1
] |
3,240 | gan.lisp | chunsj_TH/examples/gan/gan.lisp | ;; from
;; https://wiseodd.github.io/techblog/2017/01/20/gan-pytorch/
(defpackage :gan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :gan)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has following ... | 5,953 | Common Lisp | .lisp | 140 | 31.514286 | 89 | 0.508126 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 0c6ad5317397200910a63a1ad14b85844152d3e4861a8ea8ce9e56a45376f75e | 3,240 | [
-1
] |
3,241 | lsgan-layers.lisp | chunsj_TH/examples/gan/lsgan-layers.lisp | (defpackage :lsgan-layers
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.layers
#:th.db.mnist))
(in-package :lsgan-layers)
(defun build-batches (batch-size batch-count)
(let ((mnist (read-mnist-data)))
(loop :for i :from 0 :below batch-count
:for s = (* i batch... | 6,828 | Common Lisp | .lisp | 120 | 35.625 | 94 | 0.470905 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | ca326d0c05192a2a1709bff06afa2f70a925d0af12b24caba8bf659347bd08b7 | 3,241 | [
-1
] |
3,242 | gan-simple.lisp | chunsj_TH/examples/gan/gan-simple.lisp | ;; from
;; https://medium.com/@devnag/generative-adversarial-networks-gans-in-50-lines-of-code-pytorch-e81b79659e3f
(defpackage :gan-simple
(:use #:common-lisp
#:mu
#:th))
(in-package :gan-simple)
;; this simple - in terms of execution speed and complexity - gan example fits gaussian
;; random dist... | 4,931 | Common Lisp | .lisp | 98 | 39.214286 | 107 | 0.555348 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | cec5967414ff2c01168966b2ea0b0cf855e339ed3c176251ffda73ee5fd93684 | 3,242 | [
-1
] |
3,243 | dcgan-layers.lisp | chunsj_TH/examples/gan/dcgan-layers.lisp | (defpackage :dcgan-layers
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.layers
#:th.db.mnist))
(in-package :dcgan-layers)
(defun build-batches (batch-size batch-count)
(let ((mnist (read-mnist-data)))
(loop :for i :from 0 :below batch-count
:for s = (* i batch... | 6,228 | Common Lisp | .lisp | 118 | 34.279661 | 94 | 0.487192 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 694fc486cf48ab2e9f21996cbb3419e73749b6fddb26a12849cd922045848d06 | 3,243 | [
-1
] |
3,244 | cgan.lisp | chunsj_TH/examples/gan/cgan.lisp | ;; from
;; https://wiseodd.github.io/techblog/2016/12/24/conditional-gan-tensorflow/
;; https://github.com/wiseodd/generative-models/blob/master/GAN/conditional_gan/cgan_pytorch.py
(defpackage :cgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :cgan)
;; load ... | 6,930 | Common Lisp | .lisp | 156 | 33.230769 | 95 | 0.515268 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | f8c788ad9a8049ff9567c9b7cb4684044d66504675d0dbadedd5d6c8f5da5c4f | 3,244 | [
-1
] |
3,245 | infogan.lisp | chunsj_TH/examples/gan/infogan.lisp | ;; from
;; https://wiseodd.github.io/techblog/2017/01/29/infogan/
;; https://github.com/wiseodd/generative-models/blob/master/GAN/infogan/infogan_pytorch.py
(defpackage :infogan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :infogan)
;; load mnist data, takes ... | 8,418 | Common Lisp | .lisp | 203 | 30.014778 | 95 | 0.484111 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | bd1b852e4064305af02c1f90b51381a002775bb0aa72004f92f635ba67d35229 | 3,245 | [
-1
] |
3,246 | vae.lisp | chunsj_TH/examples/autoencoder/vae.lisp | (defpackage :vae-example
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.db.mnist))
(in-package :vae-example)
(defparameter *mnist* (read-mnist-data))
(defparameter *batch-size* 32)
(defparameter *max-batch-count* 10)
(defparameter *batch-count* (min *max-batch-count*
... | 9,452 | Common Lisp | .lisp | 208 | 30.860577 | 91 | 0.460938 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | e161bace7148b77f5756ee79f429b594e68cd25f5d832800789ef86e651eaca3 | 3,246 | [
-1
] |
3,247 | cae.lisp | chunsj_TH/examples/autoencoder/cae.lisp | (defpackage :cae-example
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.db.mnist))
(in-package :cae-example)
(defparameter *mnist* (read-mnist-data))
(defparameter *batch-size* 32)
(defparameter *max-batch-count* 100)
(defparameter *batch-count* (min *max-batch-count*
... | 4,516 | Common Lisp | .lisp | 92 | 31.934783 | 87 | 0.473899 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 4809d0eb6feb819af2d76d47ea97d0edb3f631b21681ecb8d8662dbc6b89dcd3 | 3,247 | [
-1
] |
3,248 | autoenc.lisp | chunsj_TH/examples/autoencoder/autoenc.lisp | ;; from
;; https://github.com/Abhipanda4/Sparse-Autoencoders
(defpackage :autoencoder
(:use #:common-lisp
#:mu
#:th
#:th.db.mnist))
(in-package :autoencoder)
;; load mnist data, takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has following dataset
;; t... | 4,385 | Common Lisp | .lisp | 115 | 25.643478 | 76 | 0.444601 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | c1b44d6588966f416909a6b31d60df88c802873179cdf9c44583e55be0b920b8 | 3,248 | [
-1
] |
3,249 | cartpole-reinforce.lisp | chunsj_TH/examples/rl/cartpole-reinforce.lisp | (defpackage :cartpole-reinforce
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :cartpole-reinforce)
;; most simpliest implementation using CartPole-v0
;; this does not uses auto differentiation of TH.
(defun policy (state w) ($softmax ($@ ... | 5,649 | Common Lisp | .lisp | 137 | 29.364964 | 97 | 0.477248 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 82dba5b86f86cdf562a60e3bbf921c30a103847e0809f2079d2e8c7c499f6932 | 3,249 | [
-1
] |
3,250 | pole.lisp | chunsj_TH/examples/rl/pole.lisp | (defpackage :cartpole
(:use #:common-lisp
#:mu
#:th))
(in-package :cartpole)
;; following code is mechanically translated from pole.c from Sutton/Barto book.
(defconstant +one-degree+ 0.0174532)
(defconstant +six-degrees+ 0.1047192)
(defconstant +twelve-degrees+ 0.2094384)
(defconstant +fifty-degre... | 6,044 | Common Lisp | .lisp | 148 | 28.101351 | 89 | 0.46729 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | b57c9fd8b79075080f08d9484379efe4bcadab3b3973e968410efaefd821ff48 | 3,250 | [
-1
] |
3,251 | cartpole-duel-ddqn.lisp | chunsj_TH/examples/rl/cartpole-duel-ddqn.lisp | (defpackage :cartpole-duel-ddqn
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :cartpole-duel-ddqn)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-rati... | 6,463 | Common Lisp | .lisp | 149 | 32.704698 | 95 | 0.532814 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 778ed2e941d1cc4509765a933a9fc461fa3f510481a3d8e51cb909146fd64e89 | 3,251 | [
-1
] |
3,252 | cartpole-per.lisp | chunsj_TH/examples/rl/cartpole-per.lisp | (defpackage :cartpole-per
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :cartpole-per)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
... | 8,245 | Common Lisp | .lisp | 197 | 32.456853 | 91 | 0.549557 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 10e140494b281ed3fd6af8dba42148f8ee9fd3d6141e86edc143c1933a3e521d | 3,252 | [
-1
] |
3,253 | cartpole-dqn.lisp | chunsj_TH/examples/rl/cartpole-dqn.lisp | (defpackage :cartpole-dqn
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :cartpole-dqn)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
... | 8,924 | Common Lisp | .lisp | 198 | 31.479798 | 97 | 0.496039 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | cdf6783cc84ecb29bdc5dfe784ce9210ffb1aab061261b6964c553c6bf3475e6 | 3,253 | [
-1
] |
3,254 | cartpole-ddqn.lisp | chunsj_TH/examples/rl/cartpole-ddqn.lisp | (defpackage :cartpole-ddqn
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole))
(in-package :cartpole-ddqn)
(defun decay-schedule (v0 minv decay-ratio max-steps &key (log-start -2) (log-base 10))
(let* ((decay-steps (round (* max-steps decay-ratio)))
... | 5,439 | Common Lisp | .lisp | 124 | 32.096774 | 95 | 0.515563 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 3f7c788ef6d18677b4a1737f6cf36fc37718f87c3b22660e767cec57fa9cfcc5 | 3,254 | [
-1
] |
3,255 | cartpole-nfq.lisp | chunsj_TH/examples/rl/cartpole-nfq.lisp | ;; from https://github.com/seungjaeryanlee/implementations-nfq.git
(defpackage :cartpole-nfq
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env))
(in-package :cartpole-nfq)
(defconstant +gravity+ 9.8D0)
(defconstant +masscart+ 1D0)
(defconstant +masspole+ 0.1D0)
(defconstant +total-... | 8,988 | Common Lisp | .lisp | 216 | 30.189815 | 92 | 0.50697 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | dfd2f43f6177c56325908cefc3890c9fbb90af12c8f3d6d487705640b60bb775 | 3,255 | [
-1
] |
3,256 | pg-compare.lisp | chunsj_TH/examples/rl/pg-compare.lisp | (defpackage :policy-gradient-comparison
(:use #:common-lisp
#:mu
#:th
#:th.layers
#:th.env
#:th.env.cartpole)
(:import-from #:th.env.examples #:short-corridor-env))
(in-package :policy-gradient-comparison)
;; for comparison, we need same starting point
(defparameter *w0* (t... | 14,938 | Common Lisp | .lisp | 341 | 30.72434 | 92 | 0.493272 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | ee91feb4956c0126657a226c7399714ccbc675f51417056e20c2e4939ca6f05d | 3,256 | [
-1
] |
3,257 | rl.lisp | chunsj_TH/examples/rl/rl.lisp | (defpackage :rl-simple
(:use #:common-lisp
#:mu
#:th))
;; XXX
;; NO, this code will not teach or show you how to trade!
(in-package :rl-simple)
(defparameter *prices* (->> (read-lines-from "./data/msft.txt")
(mapcar (lambda (s) (parse-float s)))
... | 7,530 | Common Lisp | .lisp | 157 | 38.605096 | 96 | 0.592512 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 59adb1c0a80f51458fe298cb401e099d646cdc4c7d0f96af609a5493101a1bf5 | 3,257 | [
-1
] |
3,258 | nalu.lisp | chunsj_TH/examples/nalu/nalu.lisp | ;; from
;; https://github.com/grananqvist/NALU-tf/blob/master/nalu.py
;;
;; Neural Arithmetic Logic Units
;; Refer - https://arxiv.org/abs/1808.00508
(defpackage :nalu-work
(:use #:common-lisp
#:mu
#:th))
(in-package :nalu-work)
;; XXX
;; for this kind of problem, we may need more accurate tensor d... | 3,922 | Common Lisp | .lisp | 104 | 27.432692 | 77 | 0.437664 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 3209fbc5c8295d1f0b4faa081c9fe727897e1c30eb05277e6f2770bfed36d6bb | 3,258 | [
-1
] |
3,259 | demo-genchars.lisp | chunsj_TH/examples/genchars/demo-genchars.lisp | ;; following code to demonstrate the layer based rnn code
;; this network learns from simple single sentence and
;; generates characters based on it.
(defpackage :demo-genchars
(:use #:common-lisp
#:mu
#:th
#:th.text
#:th.layers
#:th.ex.data))
(in-package :demo-genchars)
;; ... | 5,102 | Common Lisp | .lisp | 108 | 38.148148 | 99 | 0.600201 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | b6d9dad48403bec90917895a5080cf479a0157dc371d0417c80c3b0b95d2bfee | 3,259 | [
-1
] |
3,260 | eng-fra.lisp | chunsj_TH/examples/seq2seq/eng-fra.lisp | (defpackage :eng-fra
(:use #:common-lisp
#:mu
#:th
#:th.ex.data
#:th.layers
#:th.text))
(in-package :eng-fra)
(defparameter *fra-eng* (mapcar (lambda (pair) (reverse pair)) (eng-fra-small-processed)))
(defparameter *eng-prefixes* '("i am " "i m "
... | 11,317 | Common Lisp | .lisp | 219 | 34.757991 | 101 | 0.478037 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 5e5f43e5f47be962a28419607590dd48a70797b0e615e27cb48f8489c0152af7 | 3,260 | [
-1
] |
3,261 | min.lisp | chunsj_TH/pp/min.lisp | (in-package :th.pp)
(defun nm/runfunc (counter function args)
(let ((args (if (listp args) args ($list args))))
(setf ($ counter 0) (1+ ($ counter 0)))
(apply function args)))
(defun nm/xts (x xts)
(tensor (loop :for i :from 0 :below ($count xts)
:for v = ($ x i)
:for vt = ... | 9,626 | Common Lisp | .lisp | 213 | 29.920188 | 81 | 0.391258 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | a871de42e0f6ba2613d6e568e7c77f4d5212a0e5fc06557c948ebfae3e68c008 | 3,261 | [
-1
] |
3,262 | mh.lisp | chunsj_TH/pp/mh.lisp | (in-package :th.pp)
(defgeneric r/deviance (rv))
(defclass r/cvar (r/continuous)
((deviance :initform nil)))
(defclass r/dvar (r/discrete)
((deviance :initform nil)))
(defun r/cvar (value &optional deviance)
(let ((rv (make-instance 'r/cvar))
(dev deviance))
(with-slots (deviance) rv
(setf (... | 23,165 | Common Lisp | .lisp | 486 | 30.220165 | 93 | 0.453429 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | fec54f6a583a6249e12635c84f84845a00a3a21c03cfca18d07897ff19da8d94 | 3,262 | [
-1
] |
3,263 | trace.lisp | chunsj_TH/pp/trace.lisp | (in-package :th.pp)
(defclass r/trace (r/variable)
((collection :initform nil :reader trace/collection)
(proposals :initform nil :accessor trace/proposals)
(psds :initform nil :accessor trace/psds)
(burn-ins :initform 0)
(vals :initform nil :accessor trace/values)
(mean :initform nil)
(variance :in... | 6,547 | Common Lisp | .lisp | 164 | 29.54878 | 94 | 0.517209 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | ec89f45e5752a538286d4b362d6c2ad2284605d270016b5aa6c64b49ed0d23db | 3,263 | [
-1
] |
3,264 | pp.lisp | chunsj_TH/pp/pp.lisp | (defpackage :th.pp
(:use #:common-lisp
#:mu
#:th)
(:export #:mcmc/mh
#:trace/thin
#:trace/act
#:trace/values
#:trace/mean
#:trace/sd
#:trace/quantiles
#:trace/error
#:trace/hpd
#:trace/acr
#... | 411 | Common Lisp | .lisp | 18 | 12.777778 | 28 | 0.427481 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 8f49c0f2b6bd0439cab9fe3fb77f6b2e70fae0da7ff026ee392d1f0981f29dd5 | 3,264 | [
-1
] |
3,265 | rv.lisp | chunsj_TH/pp/rv.lisp | (in-package :th.pp)
(defgeneric r/variablep (rv))
(defgeneric r/continuousp (rv))
(defgeneric r/discretep (rv))
(defclass r/variable ()
((value :initform nil :accessor $data)))
(defmethod print-object ((rv r/variable) stream)
(with-slots (value) rv
(cond ((integerp value) (format stream "<~A>" ($data rv)))
... | 1,624 | Common Lisp | .lisp | 39 | 35.25641 | 90 | 0.590591 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | 5fdb84a51fa99695eb575de06f04e499396fcf32fa9d494bd15a53bca188a651 | 3,265 | [
-1
] |
3,266 | opt.lisp | chunsj_TH/pp/opt.lisp | (in-package :th.pp)
(defun objective-function (posterior initial-values)
(lambda (&rest args)
(let ((p (apply posterior
(map 'list (lambda (v v0)
(if (integerp v0)
(round v)
v))
... | 937 | Common Lisp | .lisp | 23 | 24.73913 | 79 | 0.448465 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | a5024875a83653465c1932e018507b9848ae4fd31c5f573e89aecb8e395a5f3f | 3,266 | [
-1
] |
3,267 | tensors.lisp | chunsj_TH/ffi/tensors.lisp | (declaim (optimize (speed 3) (debug 1) (safety 0)))
(in-package :th)
(defparameter *th-tensor-functions*
'(("storage" storage storageptr (tensor tensorptr))
("storageOffset" storage-offset ptrdiff-t (tensor tensorptr))
("nDimension" n-dimension :int (tensor tensorptr))
("size" size :long (tensor tensorp... | 33,707 | Common Lisp | .lisp | 500 | 62.088 | 129 | 0.667691 | chunsj/TH | 59 | 8 | 0 | GPL-3.0 | 9/19/2024, 11:26:04 AM (Europe/Amsterdam) | de736ab7b7f4496074059affb3785c1fe53079addf3e82618478e2ffcd82da5a | 3,267 | [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.