This file contains 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
(define-register A 8) | |
(define-register X 8) | |
(define-register Y 8) | |
(define-register SP 8) | |
(define-register PC 16) | |
(define-register RES 8) | |
(define-register HALT 1) |
This file contains 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 math import * | |
from random import * | |
# Basic MCMC-------------------------------------------------------------------- | |
def make_kernel(propscore): | |
def call(state, score): | |
return mh_step(state, score, propscore) | |
return call |
This file contains 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
;; Notes on "Learning Programs: A Hierarchical Bayesian Approach" | |
;; I was confused by the routing terminology and the tree transformation | |
;; figures in the paper. In particular I was not exactly sure what were the | |
;; general rules behind translating (S (B * I) I) to the square function. | |
;; B, C combinators are known as the "Turner combinators." | |
;; See http://c2.com/cgi/wiki?EssAndKayCombinators | |
;; where the translations of lambda calculus to "BSCI" calculus are given: |
This file contains 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
;; Original program | |
(letrec | |
([eq (factor (x y) (if (= x y) 0.0 (log 0.1)))] | |
[xs (repeat 10 (lambda () (xrp+init randint-scorer randint randint-prop 0 0 1)))] | |
[constr (map (lambda (xy) (eq (car xy) (car (cdr xy)))) (bigram xs))]) | |
xs) | |
;; Performance of this model (100k total iterations, lag = 10k) | |
;; running stats for (run-shred samples lag prog ALL-OPTS): |
This file contains 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
(import (grammars) | |
(printing) | |
(_srfi :1) | |
(util) | |
(program) | |
(delimcc-simple-ikarus)) | |
;; New grammar preprocessing function: lazify-nts, which uses the Scheme | |
;; procedure representation of nonterminals to return a function (not a tree) | |
;; that, when called, uses shift to capture the current context and replace it |
This file contains 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
-- Formalism of scene graphs as algebraic data types | |
{-# LANGUAGE ExistentialQuantification #-} | |
import Control.Monad | |
-- Algebraic datatypes for scene graphs | |
type Id = String | |
type Matrix = String |
This file contains 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
;; Stochastic search trees (from Kiselyov and Shan's HANSEI) | |
(import (delimcc-simple-ikarus) | |
(printing) | |
(_srfi :1)) | |
;; the core: stochastic search trees | |
(define (pv-unit v) (list (list 1.0 `(V ,v)))) | |
(define (dist pvs) |
This file contains 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
(import (printing) | |
(_srfi :1)) | |
(define start-params | |
'(1/3 1/3 1/3)) | |
(define (likelihood params) | |
(* (list-ref params 0) | |
(list-ref params 0) | |
(list-ref params 1) |
This file contains 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
(program | |
((abstraction F118 (V11) (cluster V11 2)) | |
(abstraction F117 () (cluster c137 3)) | |
(abstraction F116 (V10) (node V10 (F112) (F112))) | |
(abstraction F115 (V6 V7 V8 V9) | |
(node V9 V8 (F112) V7 (F112) V6 (F112) (F112) (F112))) | |
(abstraction F114 () (node (F112))) | |
(abstraction F113 (V5) (node V5 (F112))) | |
(abstraction F112 () | |
((lambda (V4) (cluster V4 1)) |
This file contains 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
(library (generators) | |
(export | |
yield-> | |
next-< | |
begin-< | |
) | |
(import (rnrs) | |
(delimcc-simple-ikarus) | |
) |
NewerOlder