Skip to content

Instantly share code, notes, and snippets.

@chunsj
chunsj / AD.hs
Created March 19, 2024 03:04 — forked from ttesmer/AD.hs
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# 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
@chunsj
chunsj / bo.lisp
Created September 28, 2021 09:48 — forked from lukego/bo.lisp
Bayesian Optimization
(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
@chunsj
chunsj / clojure-transduce-reduce.md
Created April 4, 2017 10:01 — forked from runexec/clojure-transduce-reduce.md
Clojure's Transducers and Reducers

Transducers and Reducers

Notes and examples of Transducers and Reducers

Reducers

  • Used on collections

  • Eager evaluation only. (not lazy)

@chunsj
chunsj / stock_trading_example.py
Created October 14, 2016 09:32 — forked from micheleorsi/stock_trading_example.py
Machine Learning with Python for Algorithmic Trading
import numpy as np
import pandas as pd
from pandas_datareader import data as web
from sklearn import linear_model
class ScikitBacktest(object):
def __init__(self,sys):
self.lags = 5
self.symbol = sys
self.get_data()
@chunsj
chunsj / win32.go
Created June 24, 2016 07:45 — forked from nathan-osman/win32.go
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
@chunsj
chunsj / hack.sh
Created December 6, 2015 09:36 — forked from dillera/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://gist.github.com/dillera/8108813/raw/ed65b97d3b910cb3536c3e522d4baebd442ff512/hack.sh | sh
#