-
Install MSYS2 (http://www.msys2.org/)
- pacman -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
-
Install Anaconda
-
Env
- conda create --name atari-rl python=3.5
- activate atari-rl
- PATH=%PATH%:D:\msys64\mingw64\bin;D:\msys64\usr\bin
- note, I installed msys64 in D:\msys64
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
struct Split<I, P> { | |
iter: I, | |
pred: P, | |
} | |
impl<I, P> Iterator for Split<I,P> where I: Iterator, P: Fn(&I::Item) -> bool { | |
type Item = Vec<I::Item>; | |
fn next(&mut self) -> Option<Vec<I::Item>> { | |
let ref p = self.pred; | |
let not_p = |x: &I::Item| !p(x); |
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
data Tag = TagStart | TagStop | Tag Int deriving (Eq, Show) | |
type Word = String | |
class CorpusModel m where | |
tags :: m -> [Tag] | |
tag_name :: m -> Tag -> String | |
tag_count_u :: m -> Tag -> Int | |
tag_count_b :: m -> (Tag, Tag) -> Int | |
tag_count_t :: m -> (Tag, Tag, Tag) -> Int | |
word_tag_count :: m -> Word -> Tag -> Int |
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
pub trait CorpusModel { | |
fn get_tags(&self) -> Range<u32>; | |
fn get_word_tag_count(&self, word: &String, tag: u32) -> u32; | |
fn get_tag_count_u(&self, tag: u32) -> u32; | |
fn get_tag_count_b(&self, tag1: u32, tag2: u32) -> u32; | |
fn get_tag_count_t(&self, tag1: u32, tag2: u32, tag3: u32) -> u32; | |
fn get_tag_name(&self, tag: u32) -> &String; | |
} | |
pub fn viterbi<M:CorpusModel>(model: &M, sentence: &Vec<String>) -> Vec<u32> { |
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
type Word = String | |
type NonTerminal = B.ByteString | |
data UnaryRule = NonTerminal :- Word deriving (Eq, Show) | |
data BinaryRule = NonTerminal := (NonTerminal, NonTerminal) deriving (Eq, Show) | |
instance Hashable UnaryRule where | |
hashWithSalt s (n :- w) = s `hashWithSalt` n `hashWithSalt` w | |
instance Hashable BinaryRule where | |
hashWithSalt s (n := (j,k)) = s `hashWithSalt` n `hashWithSalt` j `hashWithSalt` k | |
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
-- | |
-- Call the PROG as: | |
-- <PROG> -package-db=<PATH-TO-PKGCONF> | |
-- | |
-- <PATH-TO-PKGCONF> can be found by the following command: | |
-- ghc --print-global-package-db | |
-- | |
module Main where | |
import GHC |
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
{-# LANGUAGE TemplateHaskell #-} | |
import Language.Haskell.TH | |
{-- | |
-- collect the results of expressions as a tuple, | |
-- e1 >>= \a -> | |
-- e2 >>= \b -> | |
-- return (a,b) |
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
#!/usr/bin/env sh | |
sudo update-alternatives --install \ | |
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.7 200 \ | |
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.7 \ | |
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.7 \ | |
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.7 \ | |
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.7 \ | |
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.7 \ | |
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.7 \ |
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
{-# LANGUAGE ConstraintKinds, DataKinds, TypeOperators, TypeFamilies #-} | |
import GHC.Exts | |
type A a = Num a ': Eq a ': Ord a ': '[] | |
type family ListOfConstraints (a :: [Constraint]) :: Constraint where | |
ListOfConstraints '[] = () | |
ListOfConstraints (c ': cs) = (c, ListOfConstraints cs) |
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
CAFFEDIR=../caffe/cppbuild/linux-x86_64 | |
OPENCVDIR=../opencv/cppbuild/linux-x86_64 | |
INCDIR=${CAFFEDIR}/include | |
LINKOPTS=-L${CAFFEDIR}/lib -L${CAFFEDIR}/caffe-rc3/build/lib -lboost_system -lboost_thread -lgflags -lglog -lleveldb -llmdb -lopenblas -lprotobuf -lsnappy -lcaffe -lboost_filesystem -pthread -lpthread -L${OPENCVDIR}/lib -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc | |
train: train.cpp | |
g++ -o train -DCPU_ONLY -I${INCDIR} train.cpp ${LINKOPTS} | |
run: train | |
LD_LIBRARY_PATH=${CAFFEDIR}/lib:${OPENCVDIR}/lib ./train |
OlderNewer