tweak: give up on piping to Some
This commit is contained in:
parent
90e48d2249
commit
ce119253b7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -41,7 +41,8 @@ let sampleTo low high =
|
||||||
let logstd = (loghigh -. loglow) /. (2.0 -. normal_95_ci_length ) in
|
let logstd = (loghigh -. loglow) /. (2.0 -. normal_95_ci_length ) in
|
||||||
sampleLognormal logmean logstd
|
sampleLognormal logmean logstd
|
||||||
|
|
||||||
let mixture (samplers: (unit -> float) array) (weights: float array) =
|
let (|>) x f = f x
|
||||||
|
let mixture (samplers: (unit -> float) array) (weights: float array): float option =
|
||||||
match (Array.length samplers == Array.length weights) with
|
match (Array.length samplers == Array.length weights) with
|
||||||
| false -> None
|
| false -> None
|
||||||
| true ->
|
| true ->
|
||||||
|
@ -51,7 +52,7 @@ let mixture (samplers: (unit -> float) array) (weights: float array) =
|
||||||
let chosenSamplerIndex = findIndex cumsummed_normalized_weights (fun x -> x < p) in
|
let chosenSamplerIndex = findIndex cumsummed_normalized_weights (fun x -> x < p) in
|
||||||
let sample = match chosenSamplerIndex with
|
let sample = match chosenSamplerIndex with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some(i) -> Some((samplers.(i) ())) (* (samplers.(i) ()) |> Some *)
|
| Some(i) -> Some(samplers.(i) ())
|
||||||
in
|
in
|
||||||
sample
|
sample
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user