solve ordering bug, add predictions with increasing % of hypotheses.
This commit is contained in:
		
							parent
							
								
									599340fd45
								
							
						
					
					
						commit
						dbb7606917
					
				
							
								
								
									
										
											BIN
										
									
								
								src/jit_bayes
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/jit_bayes
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -58,8 +58,8 @@ proc findIndex(xs: seq[string], y: string): int = | ||||||
| proc compareTuple (x: (string, float), y: (string, float)): int =  | proc compareTuple (x: (string, float), y: (string, float)): int =  | ||||||
|   let (_, p1) = x |   let (_, p1) = x | ||||||
|   let (_, p2) = y |   let (_, p2) = y | ||||||
|   if p1 < p2: return -1 |   if p1 < p2: return 1 | ||||||
|   elif p2 > p2: return 1 |   elif p1 > p2: return -1 | ||||||
|   else: return 0 |   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)] =  | ||||||
|  | @ -85,6 +85,22 @@ proc predictContinuation(seqs: seq[seq[string]], start: seq[string]): seq[(strin | ||||||
|   return next_and_ps |   return next_and_ps | ||||||
| 
 | 
 | ||||||
| var start = @["1", "2", "3", "4", "5", "6"] | var start = @["1", "2", "3", "4", "5", "6"] | ||||||
| 
 | echo "Initial sequence", start | ||||||
| print "Full prediction with access to all hypotheses:" | 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..<n] | ||||||
|  |   return predictContinuation(truncated_seqs, start) | ||||||
|  | 
 | ||||||
|  | let l = seqs.len | ||||||
|  | for i in 1..10: | ||||||
|  |   let n = (l.float * (i.float/10.0)).int | ||||||
|  |   echo "Predictions with ", (100.0 * i.float/10.0).int, "% of the hypotheses" | ||||||
|  |   let predictions = predictContinuationWithTruncatedHypotheses(seqs, start, n) | ||||||
|  |   print predictions | ||||||
|  | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user