Skip to content

Commit

Permalink
case study for debugging baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavkulk committed Dec 11, 2024
1 parent 0c802ff commit 709b102
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/core/explain.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
(define rdiff (ulp-difference real-answer fl-answer (repr-of expr ctx)))
(cond
[(and (> diff (*condthres*)) (> rdiff 16)) (set! tp (+ tp 1))]
[(and (> diff (*condthres*)) (<= rdiff 16)) (set! fp (+ fp 1))]
[(and (> diff (*condthres*)) (<= rdiff 16))
(set! fp (+ fp 1))]
[(and (<= diff (*condthres*)) (> rdiff 16))
(set! fn (+ fn 1))]
[(and (<= diff (*condthres*)) (<= rdiff 16)) (set! tn (+ tn 1))]
Expand Down
24 changes: 7 additions & 17 deletions src/core/mainloop.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -349,24 +349,14 @@
(timeline-push! 'freqs key val))
#;(timeline-push! 'expl-stats (apply + timings) (length timings))

#;(define confusion-hash (make-hash))
#;(define maybe-hash (make-hash))

#;(for [(i (in-inclusive-range 0 10))]
(parameterize ([*maybethres* (lf (exact->inexact (expt 2 i)))]
[*condthres* (lf (exact->inexact (* 4 (expt 2 i))))])
(define-values (fperror
explanations-table
confusion-matrix
maybe-confusion-matrix
total-confusion-matrix
freqs
timings)
(explain expr context pcontext))
(define confusion-hash (make-hash))

(for [(i (in-inclusive-range 0 10))]
(parameterize ([*condthres* (lf (exact->inexact (* 4 (expt 2 i))))])
(define confmatr (explain expr context pcontext))
(define key (string->symbol (~a i)))
(hash-set! confusion-hash key confusion-matrix)
(hash-set! maybe-hash key maybe-confusion-matrix)))
#;(timeline-push! 'prcurve confusion-hash maybe-hash)
(hash-set! confusion-hash key confmatr)))
(timeline-push! 'prcurve confusion-hash)
#;(eprintf confusion-hash maybe-hash))

(define (make-regime! alts)
Expand Down
2 changes: 1 addition & 1 deletion src/reports/timeline.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
maybemat))

(define (render-phase-prcurve prcurve)
(match-define (list (list confusion-hash maybe-hash)) prcurve)
(match-define (list (list confusion-hash)) prcurve)
(define res (for/list [(i (in-inclusive-range 0 10))]
(define key (string->symbol (~a i)))
(define conmat (hash-ref confusion-hash key))
Expand Down
7 changes: 3 additions & 4 deletions src/utils/timeline.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,10 @@
(map + list1 list2))))

(define (merge-pr-curves l1 l2)
(match-define (list (list a1 b1)) l1)
(match-define (list (list a2 b2)) l2)
(match-define (list (list a1)) l1)
(match-define (list (list a2)) l2)
(define a (hash-union a1 a2 #:combine (lambda (l1 l2) (map + l1 l2))))
(define b (hash-union b1 b2 #:combine (lambda (l1 l2) (map + l1 l2))))
(list (list a b)))
(list (list a)))

(define-timeline type #:custom (λ (a b) a))
(define-timeline time #:custom +)
Expand Down

0 comments on commit 709b102

Please sign in to comment.