From 510519b24ac2265934140ca579f1d9f6d6b2b8f4 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Wed, 19 Feb 2020 17:49:42 +0000 Subject: [PATCH] Minor cleanup --- .../charts/GenericDistributionChart.re | 2 +- src/core/MixedCdf.re | 14 -------------- src/core/Shape.re | 16 ++++------------ 3 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 src/core/MixedCdf.re diff --git a/src/components/charts/GenericDistributionChart.re b/src/components/charts/GenericDistributionChart.re index fa908216..61b2bcb3 100644 --- a/src/components/charts/GenericDistributionChart.re +++ b/src/components/charts/GenericDistributionChart.re @@ -31,7 +31,7 @@ module Mixed = { {x |> E.Float.toString |> ReasonReact.string} - {Shape.Mixed.getYIntegral(x, data) + {Shape.Mixed.findYIntegral(x, data) |> E.O.fmap(E.Float.with2DigitsPrecision) |> E.O.default("") |> ReasonReact.string} diff --git a/src/core/MixedCdf.re b/src/core/MixedCdf.re deleted file mode 100644 index 2006df48..00000000 --- a/src/core/MixedCdf.re +++ /dev/null @@ -1,14 +0,0 @@ -type t = DistributionTypes.mixedShape; - -type yPdfPoint = { - continuous: float, - discrete: float, -}; - -let getY = (t: t, x: float): yPdfPoint => { - continuous: Shape.Continuous.findY(x, t.continuous), - discrete: Shape.Discrete.findY(x, t.discrete), -} /* discrete: Shape.Discrete.findY(x, t.discrete)*/; - -// let getIntegralY = (t: t, x: float): float => { -// continuous: Shape.Continuous.findY(x, t.continuous), \ No newline at end of file diff --git a/src/core/Shape.re b/src/core/Shape.re index 1c596cfd..757e1e68 100644 --- a/src/core/Shape.re +++ b/src/core/Shape.re @@ -99,14 +99,6 @@ module XYShape = { let findY = CdfLibrary.Distribution.findY; let findX = CdfLibrary.Distribution.findX; }; -// let massWithin = (t: t, left: pointInRange, right: pointInRange) => { -// switch (left, right) { -// | (Unbounded, Unbounded) => t |> ySum -// | (Unbounded, X(f)) => t |> integral |> getY(t, 3.0) -// | (X(f), Unbounded) => ySum(t) -. getY(integral(t), f) -// | (X(l), X(r)) => getY(integral(t), r) -. getY(integral(t), l) -// }; -// }; module Continuous = { let fromArrays = XYShape.fromArrays; @@ -182,13 +174,13 @@ module Mixed = { discreteProbabilityMassFraction: float, }; - let getY = (t: DistributionTypes.mixedShape, x: float): yPdfPoint => { + let findY = (t: DistributionTypes.mixedShape, x: float): yPdfPoint => { continuous: Continuous.findY(x, t.continuous) |> E.O.some, discrete: Discrete.findY(x, t.discrete) |> E.O.some, discreteProbabilityMassFraction: t.discreteProbabilityMassFraction, }; - let getYIntegral = + let findYIntegral = (x: float, t: DistributionTypes.mixedShape): option(float) => { let c = t.continuous |> Continuous.findIntegralY(x); let d = Discrete.findIntegralY(x, t.discrete); @@ -208,7 +200,7 @@ module Any = { let y = (t: t, x: float) => switch (t) { - | Mixed(m) => `mixed(Mixed.getY(m, x)) + | Mixed(m) => `mixed(Mixed.findY(m, x)) | Discrete(discreteShape) => `discrete(Discrete.findY(x, discreteShape)) | Continuous(continuousShape) => `continuous(Continuous.findY(x, continuousShape)) @@ -216,7 +208,7 @@ module Any = { let yIntegral = (t: t, x: float) => switch (t) { - | Mixed(m) => `mixed(Mixed.getYIntegral(x, m)) + | Mixed(m) => `mixed(Mixed.findYIntegral(x, m)) | Discrete(discreteShape) => `discrete(Discrete.findIntegralY(x, discreteShape)) | Continuous(continuousShape) =>