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
import Base: isempty, start, next, done, length, getindex, minimum, maximum, search, show | |
export Treap, TreapNode | |
type TreapNode{K} | |
priority::Float64 | |
size::Int | |
key::K | |
left::TreapNode{K} | |
right::TreapNode{K} |
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
import Control.Monad | |
import Data.Char | |
import qualified Data.List.Key as K | |
import System.Random | |
data Treap k a = Nil | Node Int k a (Treap k a) (Treap k a) | |
priority :: Treap k a -> Int | |
priority Nil = -1 | |
priority (Node p _ _ _ _) = p |
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
module HMM | |
using Distributions | |
import Distributions.rand | |
import Distributions.fit | |
immutable HiddenMarkovModel{TP, K} | |
theta::Vector{TP} | |
A::Matrix{Float64} |
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
# Author: Roman Sinayev | |
# License: BSD Style. | |
# Viterbi algorithm implementation and example written in Julia Language | |
# | |
# The idea is to decode the most probable order of a hidden markov model | |
# based on indirect observations. | |
# In the example below, we attempt to determine where a person is based on | |
# their cell phone service strength. We also have fake probabilities associated | |
# with each state(location) and with transitions between locations and with |
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
#lang racket | |
;; 0CFA in the AAM style on some hairy Church numeral churning | |
;; Moral: per machine-state store polyvariance is not viable, | |
;; but with widening it's not so bad. | |
;; (X -> Set X) -> (Set X) -> (Set X) | |
(define ((appl f) s) | |
(for/fold ([i (set)]) |
NewerOlder