Переглянути джерело

Tweak big theta definition and metric display names

Kirk Trombley 3 роки тому
батько
коміт
70a9cd5efe
1 змінених файлів з 9 додано та 9 видалено
  1. 9 9
      web/metrics.js

+ 9 - 9
web/metrics.js

@@ -7,13 +7,13 @@ const metrics = {
     `,
     evaluate: (data, target) => Math.sqrt(data.inertia - 2 * vectorDot(data.mu.vector, target.vector) + target.sqMag),
   },
-  bigTheta: { // inverse of arith mean of cosine similarity
-    option: "Inverse Cosine Similarity (Θ)",
+  bigTheta: { // 1 - arith mean of cosine similarity
+    option: "Cosine Difference (Θ)",
     displayName: String.raw`\Theta`,
     displayBody: p => String.raw`
-      \frac{1}{\hat{q}\cdot\vec{\nu}\left(${p}\right)}
+      1 - \hat{q}\cdot\vec{\nu}\left(${p}\right)
     `,
-    evaluate: (data, target) => 1 / vectorDot(data.nu, target.unit),
+    evaluate: (data, target) => 1 - vectorDot(data.nu, target.unit),
   },
   },
   theta: { // angle of mean
@@ -25,7 +25,7 @@ const metrics = {
     evaluate: (data, target) => rad2deg * Math.acos(vectorDot(data.mu.unit, target.unit)),
   },
   phi: { // hue angle
-    option: "Hue Difference (ϕ)",
+    option: "Hue Azimuth (ϕ)",
     displayName: String.raw`\phi`,
     displayBody: (p, space) => String.raw`
       \angle \left(\text{oproj}_{\vec{${space === "jab" ? "J" : "L"}}}{\vec{q}}, \text{oproj}_{\vec{${space === "jab" ? "J" : "L"}}}{\vec{\mu}\left(${p}\right)} \right)
@@ -36,7 +36,7 @@ const metrics = {
     },
   },
   delta: { // euclidean
-    option: "Euclidean Distance (δ)",
+    option: "Euclidean (δ)",
     displayName: String.raw`\delta`,
     displayBody: p => String.raw`
       \left|\left| \vec{q} - \vec{\mu}\left(${p}\right) \right|\right|
@@ -44,7 +44,7 @@ const metrics = {
     evaluate: (data, target) => vectorMag(data.mu.vector.map((x, i) => x - target.vector[i])),
   },
   manhattan: { // manhattan distance
-    option: "Manhattan Distance (M)",
+    option: "Manhattan (M)",
     displayName: "M",
     displayBody: p => String.raw`
       \sum_{i} \left| \vec{\mu}\left(${p}\right)_i - \vec{q}_i \right|
@@ -52,7 +52,7 @@ const metrics = {
     evaluate: (data, target) => data.mu.vector.map((x, i) => Math.abs(x - target.vector[i])).reduce((x, y) => x + y),
   },
   ch: { // chebyshev
-    option: "Chebyshev Distance (Ч)",
+    option: "Chebyshev (Ч)",
     displayName: "Ч",
     displayBody: p => String.raw`
       \max_{i} \left| \vec{\mu}\left(${p}\right)_i - \vec{q}_i \right|
@@ -60,7 +60,7 @@ const metrics = {
     evaluate: (data, target) => Math.max(...data.mu.vector.map((x, i) => Math.abs(x - target.vector[i]))),
   },
   lightnessDiff: {
-    option: "Lightness Difference (ℓ)",
+    option: "Lightness (ℓ)",
     displayName: String.raw`\ell`,
     displayBody: (p, space) => String.raw`
       \left| \text{comp}_{\vec{${space === "jab" ? "J" : "L"}}}{\vec{q}} - \text{comp}_{\vec{${space === "jab" ? "J" : "L"}}}{\vec{\mu}\left(${p}\right)} \right|