ui pack redo
This commit is contained in:
@@ -79,7 +79,8 @@ public sealed class PrivacyBudgetTrackerTests
|
||||
var snapshot = tracker.GetSnapshot();
|
||||
Assert.Equal(2, snapshot.QueriesThisPeriod);
|
||||
Assert.Equal(1, snapshot.SuppressedThisPeriod);
|
||||
Assert.True(snapshot.Exhausted);
|
||||
Assert.False(snapshot.Exhausted);
|
||||
Assert.Equal(0.1, snapshot.Remaining, precision: 10);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -121,6 +121,9 @@ public sealed class TelemetryAggregatorTests
|
||||
{
|
||||
var (aggregator, budget) = CreateAggregator(kThreshold: 1, epsilon: 0.01);
|
||||
|
||||
// Pre-spend enough budget so the aggregation pass must suppress some buckets.
|
||||
Assert.True(budget.TrySpend(0.0095));
|
||||
|
||||
// Create many CVE groups to exhaust the tiny budget
|
||||
var facts = new List<TelemetryFact>();
|
||||
for (int i = 0; i < 100; i++)
|
||||
|
||||
@@ -129,7 +129,7 @@ public sealed class PrivacyBudgetTracker : IPrivacyBudgetTracker
|
||||
}
|
||||
}
|
||||
|
||||
internal static double LaplacianNoise(double sensitivity, double epsilon, Random rng)
|
||||
public static double LaplacianNoise(double sensitivity, double epsilon, Random rng)
|
||||
{
|
||||
double u = rng.NextDouble() - 0.5;
|
||||
return -(sensitivity / epsilon) * Math.Sign(u) * Math.Log(1 - 2 * Math.Abs(u));
|
||||
|
||||
Reference in New Issue
Block a user