Minor renaming
This commit is contained in:
parent
96df9ced85
commit
19e9eaee83
|
@ -123,7 +123,7 @@ module TreeNode = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module VerticalScaling = {
|
module VerticalScaling = {
|
||||||
let toLeaf = (operationToLeaf,scaleOp, t, scaleBy) => {
|
let toLeaf = (operationToLeaf, scaleOp, t, scaleBy) => {
|
||||||
// scaleBy has to be a single float, otherwise we'll return an error.
|
// scaleBy has to be a single float, otherwise we'll return an error.
|
||||||
let fn = SymbolicTypes.Scale.toFn(scaleOp);
|
let fn = SymbolicTypes.Scale.toFn(scaleOp);
|
||||||
let knownIntegralSumFn =
|
let knownIntegralSumFn =
|
||||||
|
@ -182,7 +182,7 @@ module TreeNode = {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
let toLeaf = (operationToLeaf,pointwiseOp, t1, t2) => {
|
let toLeaf = (operationToLeaf, pointwiseOp, t1, t2) => {
|
||||||
switch (pointwiseOp) {
|
switch (pointwiseOp) {
|
||||||
| `Add => pointwiseAdd(operationToLeaf, t1, t2)
|
| `Add => pointwiseAdd(operationToLeaf, t1, t2)
|
||||||
| `Multiply => pointwiseMultiply(operationToLeaf, t1, t2)
|
| `Multiply => pointwiseMultiply(operationToLeaf, t1, t2)
|
||||||
|
@ -267,11 +267,11 @@ module TreeNode = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module FloatFromDist = {
|
module FloatFromDist = {
|
||||||
let evaluateFromSymbolic = (distToFloatOp: distToFloatOperation, s) => {
|
let symbolicToLeaf = (distToFloatOp: distToFloatOperation, s) => {
|
||||||
SymbolicDist.T.operate(distToFloatOp, s)
|
SymbolicDist.T.operate(distToFloatOp, s)
|
||||||
|> E.R.bind(_, v => Ok(`Leaf(`SymbolicDist(`Float(v)))));
|
|> E.R.bind(_, v => Ok(`Leaf(`SymbolicDist(`Float(v)))));
|
||||||
};
|
};
|
||||||
let evaluateFromRenderedDist =
|
let renderedToLeaf =
|
||||||
(distToFloatOp: distToFloatOperation, rs: DistTypes.shape)
|
(distToFloatOp: distToFloatOperation, rs: DistTypes.shape)
|
||||||
: result(treeNode, string) => {
|
: result(treeNode, string) => {
|
||||||
Distributions.Shape.operate(distToFloatOp, rs)
|
Distributions.Shape.operate(distToFloatOp, rs)
|
||||||
|
@ -285,13 +285,12 @@ module TreeNode = {
|
||||||
)
|
)
|
||||||
: result(treeNode, string) => {
|
: result(treeNode, string) => {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
| `Leaf(`SymbolicDist(s)) => evaluateFromSymbolic(distToFloatOp, s) // we want to evaluate the distToFloatOp on the symbolic dist
|
| `Leaf(`SymbolicDist(s)) => symbolicToLeaf(distToFloatOp, s) // we want to evaluate the distToFloatOp on the symbolic dist
|
||||||
| `Leaf(`RenderedDist(rs)) =>
|
| `Leaf(`RenderedDist(rs)) => renderedToLeaf(distToFloatOp, rs)
|
||||||
evaluateFromRenderedDist(distToFloatOp, rs)
|
|
||||||
| `Operation(op) =>
|
| `Operation(op) =>
|
||||||
E.R.bind(
|
E.R.bind(
|
||||||
operationToLeaf(op),
|
operationToLeaf(op),
|
||||||
toLeaf(operationToLeaf,distToFloatOp),
|
toLeaf(operationToLeaf, distToFloatOp),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -310,10 +309,7 @@ module TreeNode = {
|
||||||
Ok(`Leaf(`RenderedDist(SymbolicDist.T.toShape(sampleCount, d))))
|
Ok(`Leaf(`RenderedDist(SymbolicDist.T.toShape(sampleCount, d))))
|
||||||
| `Leaf(`RenderedDist(_)) as t => Ok(t) // already a rendered shape, we're done here
|
| `Leaf(`RenderedDist(_)) as t => Ok(t) // already a rendered shape, we're done here
|
||||||
| `Operation(op) =>
|
| `Operation(op) =>
|
||||||
E.R.bind(
|
E.R.bind(operationToLeaf(op), toLeaf(operationToLeaf, sampleCount))
|
||||||
operationToLeaf(op),
|
|
||||||
toLeaf(operationToLeaf, sampleCount),
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -352,14 +348,10 @@ module TreeNode = {
|
||||||
t,
|
t,
|
||||||
)
|
)
|
||||||
| `FloatFromDist(distToFloatOp, t) =>
|
| `FloatFromDist(distToFloatOp, t) =>
|
||||||
FloatFromDist.toLeaf(operationToLeaf(sampleCount),distToFloatOp, t)
|
FloatFromDist.toLeaf(operationToLeaf(sampleCount), distToFloatOp, t)
|
||||||
| `Normalize(t) => Normalize.toLeaf(operationToLeaf(sampleCount), t)
|
| `Normalize(t) => Normalize.toLeaf(operationToLeaf(sampleCount), t)
|
||||||
| `Render(t) =>
|
| `Render(t) =>
|
||||||
Render.toLeaf(
|
Render.toLeaf(operationToLeaf(sampleCount), sampleCount, t)
|
||||||
operationToLeaf(sampleCount),
|
|
||||||
sampleCount,
|
|
||||||
t,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user