Skip to content

Instantly share code, notes, and snippets.

Welcome to Mezzanine v. 0.2.0! Privately think of a criterion concerning
natural numbers not greater than 50. This program will attempt to efficiently
infer the nature of the criterion by asking you whether specific numbers do or
do not have the property of satisfying the criterion.
Size of hypothesis space: 21984
This program's belief distribution (over 21984 remaining hypotheses) has an
entropy of 14.424 bits. Learning whether 18 has the property is expected to
reduce the entropy by 1.000 bits.
Does 18 have the property? [Y/n] >> n
On the question of whether 18 has the property, you said false.
https://docs.google.com/forms/d/1fkTXWOjVLirPuX0VO8AhDLWRM-lbfGD0ERshGSuTQbI/viewform
@zackmdavis
zackmdavis / gist:bb4f1ea3b2b5ea11b31d
Created January 24, 2016 08:47
Less Wrong comments word vector exploration
in [200]: by_first_component[:100]
Out[200]:
[('u', -1.9398326),
('parameter', -1.8654854),
('1-p', -1.8631597),
('f', -1.8552135),
('T', -1.7352118),
('q', -1.6937695),
('F', -1.6872095),
('Pr', -1.6614704),
import csv
import logging
import bleach
import textblob
import gensim
from sklearn.decomposition import PCA
from numpy import dot
from numpy.linalg import norm
break
}
panic(err)
}
log.Printf("request is %#+v", req)
switch req := req.(type) {
case *fuse.StatfsRequest:
stats, err := mountHandle.Statfs()
#/usr/bin/env python3
from enum import Enum
from random import choice, randint
from datetime import datetime
from operator import add, sub, mul # binary operations as functions!
# Enums were introduced in 3.4!
Operation = Enum('Operation', ('add', 'subtract', 'multiply'))
@zackmdavis
zackmdavis / svd.rs
Created May 6, 2016 04:35
naive singular value decomposition draft
pub fn singular_value_decomp(&self) -> (Matrix<T>, Matrix<T>, Matrix<T>) {
let ata = self.transpose() * self;
let (ata_eigenvals, ata_eigvecs) = ata.eigendecomp();
// (index, √λ) pairs (indices being order of return from `.eigendecomp`)
let mut enumerated_singular_vals = ata_eigenvals.iter()
.map(|s| s.sqrt())
.enumerate()
.collect::<Vec<_>>();
@zackmdavis
zackmdavis / slo.go
Created May 13, 2016 21:46
writing Static Large Objects to Swift from Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
in [1]: import ast; from ast import *
in [2]: m = ast.parse('def at(): print("@")')
in [3]: m.body[0].name = "@"
in [4]: exec(compile(m, "<string>", 'exec'))
in [5]: globals()['@']
Out[5]: <function __main__.@>
in [1]: import ast; from ast import *
in [2]: m = ast.parse('def at(): print("@")')
in [3]: m.body[0].name = "@"
in [4]: exec(compile(m, "<string>", 'exec'))
in [5]: globals()['@']
Out[5]: <function __main__.@>