This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeSynonymInstances #-} | |
data Dual d = D Float d deriving Show | |
type Float' = Float | |
diff :: (Dual Float' -> Dual Float') -> Float -> Float' | |
diff f x = y' | |
where D y y' = f (D x 1) | |
class VectorSpace v where | |
zero :: v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage bo | |
(:use :common-lisp :alexandria :serapeum :trivia)) | |
(in-package :bo) | |
;;;; Bayesian Optimization based on Tree-structured Parzen Estimator and naive-Bayes. | |
;;; | |
;;; based on Rust code at https://docs.rs/tpe/0.1.1/tpe/ | |
;;; which is inspired by https://optuna.org/ | |
;;; which is inspired by http://hyperopt.github.io/hyperopt/ | |
;;; which is described in https://proceedings.neurips.cc/paper/2011/file/86e8f7ab32cfd12577bc2619bc635690-Paper.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun weighting/same (prices) | |
"returns integral weights to make similar amounts" | |
(labels ((dp (&rest args) | |
(let ((ns (mapcar #'round args))) | |
(if (> ($sum (mapcar (lambda (n) (if (<= n 0) 1 0)) ns)) 0) | |
most-positive-single-float | |
(let ((vals (mapcar (lambda (price n) (* n price)) prices ns))) | |
(loop :for v :in vals | |
:summing ($sum (mapcar (lambda (u) ($square (- u v))) vals)))))))) | |
(multiple-value-bind (weights dp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage :gdrl-ch11 | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.layers | |
#:th.env | |
#:th.env.cartpole)) | |
(in-package :gdrl-ch11) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage :gdrl-ch10 | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.layers | |
#:th.env | |
#:th.env.cartpole-regulator)) | |
(in-package :gdrl-ch10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; from https://github.com/seungjaeryanlee/implementations-nfq.git | |
(defpackage :cartpole2 | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.layers | |
#:th.env)) | |
(in-package :cartpole2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; from https://github.com/seungjaeryanlee/implementations-nfq.git | |
(defpackage :cartpole2 | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.layers | |
#:th.env)) | |
(in-package :cartpole2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; from | |
;; http://karpathy.github.io/2015/05/21/rnn-effectiveness/ | |
(defpackage :genchars-obama-lstm | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.ex.data)) | |
(in-package :genchars-obama-lstm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage :vgg16-example | |
(:use #:common-lisp | |
#:mu | |
#:th | |
#:th.m.vgg16 | |
#:th.image)) | |
(in-package :vgg16-example) | |
;; load weights - takes some time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 | |
(ql:quickload :opticl) | |
(defpackage :cgan | |
(:use #:common-lisp | |
#:mu | |
#:th |
NewerOlder