You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: CoRetweetsNumpyApproach produces incorrect results compared to CoRetweetsApproach
Labels: bug, priority:high, correctness
Description
The NumPy-optimized version of the co-retweets detection approach (CoRetweetsNumpyApproach) does not produce equivalent results to the standard implementation (CoRetweetsApproach), despite passing synthetic correctness tests.
While the NumPy implementation passes all synthetic tests in test_numpy_correctness.py, it appears to produce different results on real datasets compared to the standard approach. This suggests:
The synthetic tests may not cover all edge cases present in real data
There may be subtle differences in how the vectorized operations handle certain scenarios
Potential issues with timestamp handling or floating-point precision
Expected Behavior
CoRetweetsNumpyApproach should produce identical results to CoRetweetsApproach for all datasets and parameters, with the only difference being improved performance.
Current Status
✅ Synthetic tests pass (10/10 test cases)
❌ Real dataset results differ from standard approach
⚠️ Performance optimization is effective but correctness is not guaranteed
Impact
Users should not usecoretweets_numpy in production until this is resolved
The standard coretweets approach remains reliable and should be used for all experiments
This issue affects reproducibility and comparability of results
Reproduction
# Run correctness tests (these pass)
python examples/test_numpy_correctness.py
# Benchmark on real data (results will differ)
python examples/benchmark_coretweets.py /path/to/dataset/Processed/
# Run both approaches on same dataset and compare
python bin/run_experiments.py --approaches coretweets coretweets_numpy --datasets Armenia
Investigation Needed
Identify discrepancies: Run both approaches on real datasets and compare pair-by-pair results
Debug vectorization logic: Review lines 68-86 in coretweets_numpy.py for issues with:
Time difference calculations (relative vs absolute timestamps)
Boolean masking and early termination logic
Handling of edge cases (boundary times, same user pairs)
Enhance test coverage: Add tests with real data characteristics:
Timestamp precision edge cases
Large time gaps between retweets
Viral tweets with many retweets
Users retweeting same tweet multiple times
Possible Fixes
Revert to non-vectorized approach for correctness
Fix the vectorization logic to handle all edge cases
Add comprehensive integration tests with real data
Consider alternative vectorization strategies (e.g., using pandas or polars)
Workaround
Until fixed, use the standard coretweets approach:
# DO use thisapproach=ApproachFactory.create('coretweets', window_sec=60, min_coactions=1)
# DO NOT use this (yet)# approach = ApproachFactory.create('coretweets_numpy', window_sec=60, min_coactions=1)
Priority
High - This affects correctness of detection results and could lead to invalid research conclusions if used in production.
Title: CoRetweetsNumpyApproach produces incorrect results compared to CoRetweetsApproach
Labels: bug, priority:high, correctness
Description
The NumPy-optimized version of the co-retweets detection approach (
CoRetweetsNumpyApproach) does not produce equivalent results to the standard implementation (CoRetweetsApproach), despite passing synthetic correctness tests.Location
src/approaches/coretweets_numpy.pysrc/approaches/coretweets.pyexamples/test_numpy_correctness.pyProblem
While the NumPy implementation passes all synthetic tests in
test_numpy_correctness.py, it appears to produce different results on real datasets compared to the standard approach. This suggests:Expected Behavior
CoRetweetsNumpyApproachshould produce identical results toCoRetweetsApproachfor all datasets and parameters, with the only difference being improved performance.Current Status
Impact
coretweets_numpyin production until this is resolvedcoretweetsapproach remains reliable and should be used for all experimentsReproduction
Investigation Needed
coretweets_numpy.pyfor issues with:Possible Fixes
Workaround
Until fixed, use the standard
coretweetsapproach:Priority
High - This affects correctness of detection results and could lead to invalid research conclusions if used in production.
Related Files
src/approaches/coretweets_numpy.py- NumPy implementationsrc/approaches/coretweets.py- Standard implementation (reference)examples/test_numpy_correctness.py- Current test suiteexamples/benchmark_coretweets.py- Performance comparison toolNext Steps