From 4228edfb2593582fdb1a9c64f8c7695835e9a707 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 24 May 2023 14:47:34 -0700 Subject: [PATCH] small format & refactor --- src/jit_bayes | Bin 277368 -> 277208 bytes src/jit_bayes.nim | 38 +++++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/jit_bayes b/src/jit_bayes index 82f7aaa4e58d0e0c40d0396debae19213f8b0303..bc65513e8940e8dc766b897715e18384678fb2cc 100755 GIT binary patch delta 18119 zcmZ{r30PFs`^WFha1{crRjR1|G#oQavG>9m0>2*!0 zD9j~CP29y5T$9{)aYZw8tXzuW{=e@%XE6Cczj+@0ocn&y`#sA&_sqQ)c>37?+~59b z5yo>(oQSuQ^iSgjQHBGn$-d>&UaCS@-^ ze{pohE$i=WoN2O#8P%LQ2kYe=tY?@!%&_OvHlG@D+I(v4T*ojyXU;04>TL+gNp>2K z)-+7X>Hmw-XfVX*3_M{BP!02G>}g{=TAOXGK@V~am3%)QswmcEOTIN#9ZZHZ#+n8f zg`P21HP#W1aY$X~;hoSqzscU*^*uVFm8Y^jOfBMz>r|8-#YTp-)+PcxY4aV?3 zdxz-lWy5j&V7<5n7VCM6M&(&@xhYGAH94^ak!#s8JENO_~Jhc7gU36;r zHr+1`RTt~=6iX7fQ?gHwFGkb&XGyarpW(1+s~+ZMD`vArs_N~r=H~Ttjf$2{qIsMO zKIfmv>DwmSm>WZeM#ez$tzxVc8u||AC1vgaOe#(_FNwQ{-I^xWaZbU4!hw~IuUKiv zSz}O$*Mt%+?a)46;{B}2w~BsxSJR5ljlq9w_R+($##cKe{RFpE%R}z%LUh8I#vJDNhlRNGGk6+3rhIbpir#}W&PoRM z5}xp7rIqJe(NV6C&felNBu0mFf{z=Iqq##{1!Pa0$MSBEOTuI7k?G zl*UDC(0yz2K_1j^n2w7+ev0b62W#vb)zN`0E~B@@FLG^lJ`VY_tDK(I zb`*M1RQYSYN7K1#o?~vW=iQIvP)d7$41uH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i;Zx6Fo5n z;kujdI4{Ybz07BOie0P*R}XA}c)n#x|B_5vd7>nPTI>ycq}IVLvyH=hi6<)LZau7A zbdA^JHop3rAc%e~ zJ2mlDkBz0|?w)I=nIH)Vu)EKd>o}42&~-ie^Pps?oE6T#X1QONdC07Sw&IJrtswO; zZR}jf@9)jwXa>md{<)#)5E?c$5&e0#ZZ&PZ;F_Vu6F0|yvcw%^6r*iJC++Gvi=?T% zLfdmq;~z-5zQf(W{D4_563yjcg!Q+>aXdXuza2li+W#gSpL$KakX`N0tBG;o)3Ces zqP@n)+ta?Ujo)v4u5*g6F`6uU7-8&N;r@%R?tiy<4kMpL)?tUQV%F8UC<(}(rg9b} zB&M24%(5oo#T!Ii2esV}s*6n@CiB#Ml1*E7P2YTSQuD7}a}U3`q1LU`Hg34}>VY=8 z$Mjuv%^v7#<4*C_?MF-65$u+R6y}Dd;Ic-Z^_RR5B=ljgG?|ro@47Ux37G{3$D{3T}o`{BpY2JvL9{I)-QJ#L^gX%;ajEosMWXPzI6B64F%g7r3 z_>lIk+7`BL9I?+6Gv=E3ZG}-yBPK=Ee(aifE9c>nj}0F)R`TK^V&&Cl5&P?o8$bM^ zkq=H7Id;tB*EDWdnAJQYREe)bvf4%5QX%{>T_kJTMYO9hF2(0A^ti&a?IMaj-pJ;% oF)`w4Z|`1`loWAWg=60vogXnIMYN0R-rDTj8$FWLCZhiT0V!l!4*&oF diff --git a/src/jit_bayes.nim b/src/jit_bayes.nim index b7c42ec..8194519 100644 --- a/src/jit_bayes.nim +++ b/src/jit_bayes.nim @@ -16,7 +16,7 @@ proc getOEIS(): seq[seq[string]] = if i > 3: let seq = split(line, ",") let l = seq.len - let nums = seq[1..(l-2)] + let nums = seq[1..(l-2)] seqs.add(nums) i = i + 1 f.close() @@ -24,7 +24,7 @@ proc getOEIS(): seq[seq[string]] = var seqs = getOEIS() ## Sequence helpers -proc startsWithSubsequence(xs: seq[string], ys: seq[string]): bool = +proc startsWithSubsequence(xs: seq[string], ys: seq[string]): bool = if xs.len == 0: return true elif ys.len == 0: @@ -34,7 +34,7 @@ proc startsWithSubsequence(xs: seq[string], ys: seq[string]): bool = else: return false -proc getSequencesWithStart(seqs: seq[seq[string]], start: seq[string]): seq[seq[string]] = +proc getSequencesWithStart(seqs: seq[seq[string]], start: seq[string]): seq[seq[string]] = var continuations: seq[seq[string]] for seq in seqs: if startsWithSubsequence(start, seq): @@ -49,23 +49,23 @@ proc getSequencesWithStart(seqs: seq[seq[string]], start: seq[string]): seq[seq[ ## Find index (or -1) -proc findIndex(xs: seq[string], y: string): int = +proc findIndex(xs: seq[string], y: string): int = for i, x in xs: if x == y: return i return -1 ## Do simple predictions -proc compareTuple (x: (string, float), y: (string, float)): int = +proc compareTuple (x: (string, float), y: (string, float)): int = let (_, p1) = x let (_, p2) = y 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)] = +proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[(string, float)] = let continuations = getSequencesWithStart(seqs, start) - let l = start.len + let l = start.len var nexts: seq[string] var ps: seq[float] for c in continuations: @@ -78,9 +78,9 @@ proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[(strin ps[i] = ps[i] + 1.0 let sum = foldl(ps, a + b, 0.0) ps = ps.map( p => p/sum) - var next_and_ps = zip(nexts, ps) + var next_and_ps = zip(nexts, ps) # next_and_ps = sort(next_and_ps, compareTuple) - sort(next_and_ps, compareTuple) + sort(next_and_ps, compareTuple) # ^ sorts in place # also, openArray refers to both arrays and sequences. return next_and_ps @@ -93,15 +93,19 @@ 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 +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..