Browse Source

Even more beta metric simplification

Kirk Trombley 3 năm trước cách đây
mục cha
commit
79692a3b03
3 tập tin đã thay đổi với 19 bổ sung17 xóa
  1. 9 9
      web/convert.js
  2. 3 2
      web/listeners.js
  3. 7 6
      web/metrics.js

+ 9 - 9
web/convert.js

@@ -19,17 +19,17 @@ const buildVectorData = (vector, toHue, toLightness, toChroma, toHex) => {
 };
 
 const calcImportance = (chroma, lightness, proportion) => (
-  // proportion component - linear, with penalties
-  proportion
+  chroma
+  + Math.tanh(100 * (chroma - 0.25)) // penalty for being <25%
+  + Math.tanh(100 * (chroma - 0.40)) // penalty for being <40%
+  + lightness 
+  + Math.tanh(100 * (lightness - 0.50)) // penalty for being <50%
+  + proportion
   + Math.tanh(100 * (proportion - 0.05)) // penalty for being <5%
+  + Math.tanh(100 * (proportion - 0.10)) // penalty for being <15%
   + Math.tanh(100 * (proportion - 0.15)) // penalty for being <15%
-  + Math.tanh(100 * (proportion - 0.75)) // penalty for being <75%
-  // chroma component - scaled, with penalty
-  + (chroma / (chroma + lightness)) // consider chroma as portion of chroma + lightness
-  + (Math.tanh(10 * (chroma - 0.25))) // penalty for being <25%
-  // lightness component - linear, with penality
-  + lightness
-  + (Math.tanh(10 * (lightness - 0.5))) // penalty for being <50%
+  + Math.tanh(100 * (proportion - 0.25)) // penalty for being <25%
+  + Math.tanh(100 * (proportion - 0.80)) // penalty for being <50%
 );
 
 const buildClusterData = (size, inertia, mu1, mu2, mu3, nu1, nu2, nu3, totalSize, toHue, toLightness, toChroma, toHex) => {

+ 3 - 2
web/listeners.js

@@ -6,8 +6,9 @@ const { rerenderSearch, onSearch, onRandomName } = (() => {
   if (DEBUG_MODE) {
     // set of some pokemon with interesting edge cases
     starting = [
-      "latias", "wailmer", "luxray", "seaking", "blastoise", "oranguru", "victreebel",
-      "blacephalon", "crustle", "rolycoly", "lucario", "abomasnow", "typhlosion",
+      "latias", "wailmer", "luxray", "seaking", "blastoise", "oranguru", 
+      "victreebel", "grimmsnarl", "rapidash", "blacephalon", "crustle", 
+      "rolycoly", "lucario", "abomasnow", "typhlosion", "chinchou",
     ];
     starting.forEach(x => clusterToggles[`${x}-search-pkmn-expand-toggle`] = true)
     results = pokemonData.filter(p => starting.includes(p.name));

+ 7 - 6
web/metrics.js

@@ -116,14 +116,15 @@ const metrics = {
     displayName: String.raw`\beta`,
     displayBody: p => String.raw`
       \begin{aligned}
-        &\frac{\left|${p}\right|}{\left|P\right|} \\
-      + &L\left(${p}\right) \\
-      + &\frac{C\left(${p}\right)}{C\left(${p}\right) + L\left(${p}\right)} \\
+        &C\left(${p}\right) + L\left(${p}\right) + \frac{\left|${p}\right|}{\left|P\right|}\\
+      + &\tanh{\left(100\left(C\left(${p}\right) - 0.25\right)\right)} \\
+      + &\tanh{\left(100\left(C\left(${p}\right) - 0.4\right)\right)} \\
+      + &\tanh{\left(100\left(L\left(${p}\right) - 0.5\right)\right)} \\
       + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.05\right)\right)} \\
+      + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.10\right)\right)} \\
       + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.15\right)\right)} \\
-      + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.75\right)\right)} \\
-      + &\tanh{\left(10\left(C\left(${p}\right) - 0.25\right)\right)} \\
-      + &\tanh{\left(10\left(L\left(${p}\right) - 0.5\right)\right)}
+      + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.25\right)\right)} \\
+      + &\tanh{\left(100\left(\frac{\left|${p}\right|}{\left|P\right|} - 0.80\right)\right)}
       \end{aligned}
     `,
     evaluate: data => data.importance,