Skip to content

Instantly share code, notes, and snippets.

@stites
stites / main.ml
Last active April 16, 2024 20:53 — forked from SHoltzen/main.ml
Homework #9 starter code
(************************************)
(* Exceptions and Testing Functions *)
(************************************)
exception Not_implemented ;;
exception Runtime ;;
(* Asserts that a function call throws a Runtime exception. *)
let assert_runtime (f: unit -> 'a): unit =
zpool create \
-o compatibility=grub2 \
-o ashift=12 \
-o autotrim=on \
-O acltype=posixacl \
-O canmount=off \
-O compression=lz4 \
-O devices=off \
-O normalization=formD \
-O relatime=on \
@stites
stites / default.nix
Created August 4, 2021 13:19
hm-stack configs
{ pkgs, ... }:
{
home.packages = [ pkgs.stack ];
home.file = {
".stack/config.yaml".source = ./local.yaml;
".stack/global-project/stack.yaml".source = ./global.yaml;
};
}
@stites
stites / resampling.py
Last active January 27, 2021 02:18
resampler
import torch
import torch.nn.functional as F
from torch import Tensor
from typing import Tuple
from torch.distributions.categorical import Categorical
from torch.distributions.uniform import Uniform
from combinators.tensor.utils import kw_autodevice
from probtorch.stochastic import Trace, RandomVariable, ImproperRandomVariable
def run_gibbs(nsweeps=1):
xs = get_dataset()
xs, ys = xs[:1,:], xs[2,:]
# xs is Shape([1000,2])
# ys is Shape([1000,1]) of cluster labels
prior = [Normal(-1, 0.5), Normal(1, 0.5)]
for sweep in range(0, nsweeps):
postieror = gibbs(prior, xs)
prior = posterior # do something with that posterior?

Keybase proof

I hereby claim:

  • I am stites on github.
  • I am stites (https://keybase.io/stites) on keybase.
  • I have a public key whose fingerprint is 2C16 B515 DB66 C385 D569 E0B8 2418 B81B A203 9C3F

To claim this, I am signing this object:

@stites
stites / stub
Created February 21, 2019 15:57
An empty file
This is primarily a stub for any nix-shells that I want to add to to my config.nix
constraints: any.Cabal ==2.2.0.1,
any.HTTP ==4000.3.12,
HTTP -conduit10 -mtl1 +network-uri -warn-as-error +warp-tests,
any.HUnit ==1.6.0.0,
any.JuicyPixels ==3.3,
JuicyPixels -mmap,
any.QuickCheck ==2.11.3,
QuickCheck +templatehaskell,
any.alex ==3.2.4,
alex +small_base,
module Torch.Models.LeNet where
data LeNet ch step = LeNet
{ _conv1 :: !(Conv2d ch 6 '(step,step))
, _conv2 :: !(Conv2d 6 16 '(step,step))
, _fc1 :: !(Linear (16*step*step) 120)
, _fc2 :: !(Linear 120 84)
, _fc3 :: !(Linear 84 10)
}
@stites
stites / LeNet.hs
Created May 30, 2018 20:50
hasktorch lenet
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fplugin GHC.TypeLits.Normalise #-}
module LeNet where
import Data.Function ((&))
import GHC.Natural