[PATCH] D49780: [clangd] Use a sigmoid style function for #usages boost in symbol quality.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 02:48:57 PDT 2018


ioeric added inline comments.


================
Comment at: clangd/Quality.cpp:200
+    //   f = 12.0
+    //   boost = f * sigmoid(m * std::log(References)) - 0.5 * f + 0.59
+    // Sample data points: (10, 1.00), (100, 1.41), (1000, 1.82),
----------------
ilya-biryukov wrote:
> Made add references or intuition on why this boosting function is good?
> Also on why can't we use the original boost function and need to simplify it?
Turned out "simplification" might be the wrong word. Improved the comment a bit.


================
Comment at: clangd/Quality.cpp:203
+    //                     (10K, 2.21), (100K, 2.58), (1M, 2.94)
+    float s = 1.0 / std::pow(References, 0.06);
+    Score *= 6.0 * (1 - s) / (1 + s) + 0.59;
----------------
ilya-biryukov wrote:
> Any reason to not use `std::pow(References, -0.06)` instead?
> (not a suggestion to actually change the code, just wondering if there are any reasons (apart from personal preferences) to prefer one over the other)
Nope, no particular reason. Positive exponent looks a bit nicer in formula, but I think it's fine here. Switched to `std::pow(References, -0.06)`.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49780





More information about the cfe-commits mailing list