This commit is contained in:
Vyacheslav Matyukhin 2022-09-20 01:26:00 +04:00
parent ea71595e23
commit 35671c5c51
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
2 changed files with 6 additions and 6 deletions

View File

@ -33,19 +33,19 @@ module Internals = {
module KDE = { module KDE = {
let normalSampling = (samples, outputXYPoints, kernelWidth) => let normalSampling = (samples, outputXYPoints, kernelWidth) =>
samples -> JS.samplesToContinuousPdf(outputXYPoints, kernelWidth) -> JS.jsToDist samples->JS.samplesToContinuousPdf(outputXYPoints, kernelWidth)->JS.jsToDist
} }
module T = { module T = {
type t = array<float> type t = array<float>
let xWidthToUnitWidth = (samples, outputXYPoints, xWidth) => { let xWidthToUnitWidth = (samples, outputXYPoints, xWidth) => {
let xyPointRange = E.A.Sorted.range(samples) -> E.O2.default(0.0) let xyPointRange = E.A.Sorted.range(samples)->E.O2.default(0.0)
let xyPointWidth = xyPointRange /. float_of_int(outputXYPoints) let xyPointWidth = xyPointRange /. float_of_int(outputXYPoints)
xWidth /. xyPointWidth xWidth /. xyPointWidth
} }
let formatUnitWidth = w => Jstat.max([w, 1.0]) -> int_of_float let formatUnitWidth = w => Jstat.max([w, 1.0])->int_of_float
let suggestedUnitWidth = (samples, outputXYPoints) => { let suggestedUnitWidth = (samples, outputXYPoints) => {
let suggestedXWidth = SampleSetDist_Bandwidth.nrd0(samples) let suggestedXWidth = SampleSetDist_Bandwidth.nrd0(samples)
@ -87,7 +87,7 @@ let toPointSetDist = (
continuousPart, continuousPart,
samplingInputs.outputXYPoints, samplingInputs.outputXYPoints,
) )
let usedWidth = samplingInputs.kernelWidth -> E.O2.default(_suggestedXWidth) let usedWidth = samplingInputs.kernelWidth->E.O2.default(_suggestedXWidth)
let usedUnitWidth = Internals.T.xWidthToUnitWidth( let usedUnitWidth = Internals.T.xWidthToUnitWidth(
samples, samples,
samplingInputs.outputXYPoints, samplingInputs.outputXYPoints,
@ -126,7 +126,7 @@ let toPointSetDist = (
let normalizedPointSet = pointSetDist->E.O2.fmap(PointSetDist.T.normalize) let normalizedPointSet = pointSetDist->E.O2.fmap(PointSetDist.T.normalize)
let samplesParse: Internals.Types.outputs = { let samplesParse: Internals.Types.outputs = {
continuousParseParams: pdf -> E.O2.fmap(snd), continuousParseParams: pdf->E.O2.fmap(snd),
pointSetDist: normalizedPointSet, pointSetDist: normalizedPointSet,
} }

View File

@ -340,7 +340,7 @@ module Floats = {
flush(cnt, prev) flush(cnt, prev)
(1, element) (1, element)
} }
} },
) )
// flush final values // flush final values