Suggest related categories with bounded data

Harbor Forum uses a fixed-size SetSketch per category to estimate shared readership. A matched 100,000-post benchmark cut query instructions by 20.3% and kept the same estimates.

Keep exact counts and estimate overlap

Harbor Forum wants to suggest categories with similar audiences. A registered reader can report a positive session length of up to one hour for a visible post. The forum derives the category from that post and returns the original receipt on an identical retry of the latest sequence. Each category keeps exact counts of accepted sessions and reported time, a 256-register SetSketch of readers, and a DDSketch of reported durations.

The readership feature can track up to 64 observed categories. A related-category query scores the other observed categories and returns up to ten, ordered by estimated Jaccard similarity and then category ID. Jaccard measures the shared readers as a fraction of the total distinct readers across both groups. The response includes sample and error information alongside the ranking.

Measure speed and accuracy together

The SDK added a grouped SetSketch comparison that reuses the reference sketch. The forum uses it when comparing two or more peers. In the 100,000-post fixture, 16 samples of the complete query averaged 18.55 million instructions before and 14.79 million after, with identical replies. Both builds already had the full feature and the same public Wire interface.

The exact reader cohorts gave the experiment a way to check approximation error. For one measured pair the estimated overlap was 0.924559 against 0.941176 exactly, and seven of the estimated top ten also appeared in the exact top ten. Use this experimental Minima collection to suggest candidates. Keep user reports, moderation decisions and authorization in exact records.

Code, tests, and related material