Fengzdadi opened a new issue, #98:
URL: https://github.com/apache/datasketches-go/issues/98

   ## Overview
   
   This issue tracks the implementation of `VarOptItemsSketch` (Variance 
Optimal Sampling) for the Go library, following the Java and C++ 
implementations.
   
   VarOpt provides weighted sampling with optimal variance for subset sum 
estimation - useful for network traffic monitoring, ad analytics, and log 
sampling.
   
   ## Proposed Implementation Plan
   
   We plan to split this into **multiple PRs** for easier review:
   
   ### PR 1: Core VarOptItemsSketch (basic functionality)
   - [ ] Add `VarOptItems` family (ID=13) to `internal/family.go`
   - [ ] Implement `VarOptItemsSketch[T]` struct with fields: k, n, h, m, r, 
totalWtR, data, weights
   - [ ] Implement warmup mode (n ≤ k): store all items
   - [ ] Implement estimation mode (n > k): weighted sampling with tau threshold
   - [ ] Min-heap operations for H region
   - [ ] Basic unit tests
   
   ### PR 2: Serialization & Compatibility
   - [ ] Implement `ToByteArray()` (Java-compatible format)
   - [ ] Implement `NewVarOptItemsSketchFromSlice()`
   - [ ] Add cross-language compatibility tests
   - [ ] Generate test data files for validation
   
   ### PR 3: Subset Sum Estimation
   - [ ] Implement `EstimateSubsetSum(predicate)` returning bounds
   - [ ] Pseudo-hypergeometric confidence intervals
   - [ ] Tests for estimation accuracy
   
   ### PR 4: VarOptItemsUnion (optional, can be deferred)
   - [ ] Implement union with gadget/marks mechanism
   - [ ] Serialization for union state
   
   ## References
   
   - Java: 
[`VarOptItemsSketch.java`](https://github.com/apache/datasketches-java/blob/master/src/main/java/org/apache/datasketches/sampling/VarOptItemsSketch.java)
   - C++: 
[`var_opt_sketch.hpp`](https://github.com/apache/datasketches-cpp/blob/master/sampling/include/var_opt_sketch.hpp)
   - Algorithm paper: [Variance Optimal 
Sampling](https://datasketches.apache.org/docs/Sampling/VarOptSamplingSketches.html)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to