step: sample from continuations.
This commit is contained in:
parent
ad57176544
commit
981fd62470
BIN
src/jit_bayes
BIN
src/jit_bayes
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
|
import print
|
||||||
import strutils
|
import strutils
|
||||||
import sequtils
|
import sequtils
|
||||||
import print
|
import std/sugar
|
||||||
|
|
||||||
## Get sequences
|
## Get sequences
|
||||||
let file_path = "../data/stripped"
|
let file_path = "../data/stripped"
|
||||||
|
@ -40,6 +41,17 @@ proc getSequencesWithStart(seqs: seq[seq[string]], start: seq[string]): seq[seq[
|
||||||
|
|
||||||
## Pretty print sequences
|
## Pretty print sequences
|
||||||
|
|
||||||
var start = @["1", "2", "3"]
|
# var start = @["1", "2", "3", "4", "5"]
|
||||||
var continuations = getSequencesWithStart(seqs, start)
|
# var continuations = getSequencesWithStart(seqs, start)
|
||||||
print continuations
|
# print continuations
|
||||||
|
|
||||||
|
## Do simple predictions
|
||||||
|
proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[string] =
|
||||||
|
let continuations = getSequencesWithStart(seqs, start)
|
||||||
|
let l = start.len
|
||||||
|
let next_items = continuations.map(c => c[l])
|
||||||
|
return next_items
|
||||||
|
|
||||||
|
var start = @["1", "2", "3", "4", "5"]
|
||||||
|
let sample_continuations = predictContinuation(seqs, start)
|
||||||
|
print(sample_continuations)
|
||||||
|
|
17
src/makefile
Normal file
17
src/makefile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
SHELL := /bin/bash ## <= required to use time
|
||||||
|
VERBOSE=--verbosity:0
|
||||||
|
|
||||||
|
build: jit_bayes.nim
|
||||||
|
nim c $(VERBOSE) jit_bayes.nim
|
||||||
|
|
||||||
|
run: jit_bayes
|
||||||
|
./jit_bayes $(VERBOSE)
|
||||||
|
|
||||||
|
examine: jit_bayes
|
||||||
|
nim c $(VERBOSE) jit_bayes.nim && time ./jit_bayes $(VERBOSE) && echo
|
||||||
|
nim c $(VERBOSE) -d:release jit_bayes.nim && time ./jit_bayes $(VERBOSE) && echo
|
||||||
|
nim c $(VERBOSE) -d:danger jit_bayes.nim && time ./jit_bayes $(VERBOSE)
|
||||||
|
|
||||||
|
time:
|
||||||
|
time make && echo && time make run
|
||||||
|
|
Loading…
Reference in New Issue
Block a user