(defn normalize-cond [cdist]
"Normalize a probability distribution resulting from a computation in
the cond-dist monad by re-distributing the weight of the invalid values
over the valid ones."
(let [missing (get cdist nil 0)
dist (dissoc cdist nil)]
(cond (zero? missing) dist
(= 1 missing) {}
:else (let [scale (/ 1 (- 1 missing))]
(scale-by dist scale)))))
Comments top
No comments for normalize-cond. Log in to add a comment.