diff --git a/src/jit_bayes b/src/jit_bayes index c88ab42..2b1564e 100755 Binary files a/src/jit_bayes and b/src/jit_bayes differ diff --git a/src/jit_bayes.nim b/src/jit_bayes.nim index c35cc5f..0701be2 100644 --- a/src/jit_bayes.nim +++ b/src/jit_bayes.nim @@ -58,8 +58,8 @@ proc findIndex(xs: seq[string], y: string): int = proc compareTuple (x: (string, float), y: (string, float)): int = let (_, p1) = x let (_, p2) = y - if p1 < p2: return -1 - elif p2 > p2: return 1 + if p1 < p2: return 1 + elif p1 > p2: return -1 else: return 0 proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[(string, float)] = @@ -85,6 +85,22 @@ proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[(strin return next_and_ps var start = @["1", "2", "3", "4", "5", "6"] - +echo "Initial sequence", start print "Full prediction with access to all hypotheses:" -print predictContinuation(seqs, start) +let continuation_probabilities = predictContinuation(seqs, start) +print continuation_probabilities + +## Predict continuation but without access to all oeis sequences + +proc predictContinuationWithTruncatedHypotheses(seqs: seq[seq[string]], start: seq[string], num_hypotheses: int): seq[(string, float)] = + let n = if num_hypotheses < seqs.len: num_hypotheses else: seqs.len + let truncated_seqs = seqs[0..