Skip to content

Commit

Permalink
modified the ranking algorithm for 1 hop answers such that the two ho…
Browse files Browse the repository at this point in the history
…ps answers are more likely to be on the top
  • Loading branch information
kaiwenho committed Aug 9, 2023
1 parent d3e4ad6 commit ded58fc
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions medikanren2/neo/neo-server/neo-server.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

(define DEFAULT_PORT 8384)

(define NEO_SERVER_VERSION "1.19")
(define NEO_SERVER_VERSION "1.20")

;; Maximum number of results to be returned from *each individual* KP,
;; or from mediKanren itself.
Expand Down Expand Up @@ -1130,9 +1130,32 @@
(define scored/q-sorted-long
(sort scored/q-unsorted-long by-score))

(define scored/q-sorted-short (take-at-most scored/q-sorted-long MAX_RESULTS_FROM_COMPONENT))

(printf "about to take the best ~s edges for MVP mode creative query\n"
(define old-scored/q-sorted-short (take-at-most scored/q-sorted-long MAX_RESULTS_FROM_COMPONENT))

(define scored/q-sorted-short
(map
(lambda (e)
(match e
[`(,score
,curie_x
,pred_xy
,curie_y
,(? string? pred_yz)
,(? string? curie_z)
,props_xy
,props_yz)
e]
[`(,score
,curie_x
,pred_xy
,curie_y
.
,props_xy)
(cons (sqrt score) (cdr e))]
[else (error "invalid form of returned edge" e)]))
old-scored/q-sorted-short))

(printf "Toke the best ~s edges for MVP mode creative query\n"
(length scored/q-sorted-short))

(define curie-representative-table '())
Expand Down

0 comments on commit ded58fc

Please sign in to comment.