|
@@ -156,7 +156,8 @@ const metrics = [
|
|
|
// mean angle
|
|
|
(stats, q) => {
|
|
|
const [ mean, scale ] = selectedSummary(stats, q);
|
|
|
- return -vectorDot(mean.unit, q.unit) * scale
|
|
|
+ // divide by scale since we're negative
|
|
|
+ return -vectorDot(mean.unit, q.unit) / scale
|
|
|
},
|
|
|
// mean dist
|
|
|
(stats, q) => {
|
|
@@ -172,7 +173,8 @@ const metrics = [
|
|
|
// max inertia
|
|
|
(stats, q) => {
|
|
|
const [ , scale ] = selectedSummary(stats, q);
|
|
|
- return -stats.inertia * scale;
|
|
|
+ // divide by scale since we're negative
|
|
|
+ return -stats.inertia / scale;
|
|
|
},
|
|
|
// custom
|
|
|
(stats, q) => {
|
|
@@ -236,14 +238,19 @@ const mathDefinitions = {
|
|
|
`,
|
|
|
};
|
|
|
|
|
|
-const clusterScaleText = muArg => (state.clusterChoice > 0 && state.includeScale ? String.raw`\frac{\left|P\right|}{\left|${muArg}\right|}` : "")
|
|
|
+const includeScaleFactor = () => state.clusterChoice > 0 && state.includeScale
|
|
|
|
|
|
const metricText = [
|
|
|
- muArg => String.raw`${mathArgBest("min", "P")}\left[${clusterScaleText(muArg)}I\left(P\right) - 2\vec{q}\cdot ${clusterScaleText(muArg)}\vec{\mu}\left(${muArg}\right)\right]`,
|
|
|
- muArg => String.raw`${mathArgBest("min", "P")}\left[-${clusterScaleText(muArg)}\cos\left(\angle \left(\vec{q}, \vec{\mu}\left(${muArg}\right)\right)\right)\right]`,
|
|
|
- muArg => String.raw`${mathArgBest("min", "P")}\left[${clusterScaleText(muArg)}\left|\left| \vec{q} - \vec{\mu}\left(${muArg}\right) \right|\right|^2\right]`,
|
|
|
- muArg => String.raw`${mathArgBest("min", "P")}\left[${clusterScaleText(muArg)}\angle \left(\vec{q}_{\perp}, \vec{\mu}\left(${muArg}\right)_{\perp} \right)\right]`,
|
|
|
- muArg => String.raw`${mathArgBest("min", "P")}\left[-${clusterScaleText(muArg)}I\left(P\right)\right]`,
|
|
|
+ muArg => String.raw`
|
|
|
+ ${mathArgBest("min", "P")}\left[
|
|
|
+ ${includeScaleFactor() ? String.raw`\frac{\left|P\right|}{\left|${muArg}\right|}\left(` : ""}
|
|
|
+ I\left(P\right) - 2\vec{q}\cdot \vec{\mu}\left(${muArg}\right)
|
|
|
+ ${includeScaleFactor() ? String.raw`\right)` : ""}
|
|
|
+ \right]`,
|
|
|
+ muArg => String.raw`${mathArgBest("min", "P")}\left[-${includeScaleFactor() ? String.raw`\frac{\left|${muArg}\right|}{\left|P\right|}` : ""}\cos\left(\angle \left(\vec{q}, \vec{\mu}\left(${muArg}\right)\right)\right)\right]`,
|
|
|
+ muArg => String.raw`${mathArgBest("min", "P")}\left[${includeScaleFactor() ? String.raw`\frac{\left|P\right|}{\left|${muArg}\right|}` : ""}\left|\left| \vec{q} - \vec{\mu}\left(${muArg}\right) \right|\right|^2\right]`,
|
|
|
+ muArg => String.raw`${mathArgBest("min", "P")}\left[${includeScaleFactor() ? String.raw`\frac{\left|P\right|}{\left|${muArg}\right|}` : ""}\angle \left(\vec{q}_{\perp}, \vec{\mu}\left(${muArg}\right)_{\perp} \right)\right]`,
|
|
|
+ muArg => String.raw`${mathArgBest("min", "P")}\left[-${includeScaleFactor() ? String.raw`\frac{\left|${muArg}\right|}{\left|P\right|}` : ""}I\left(P\right)\right]`,
|
|
|
].map(s => muArg => TeXZilla.toMathML(s(muArg)));
|
|
|
|
|
|
const muArgs = [
|