[−][src]Struct b2dp::utilities::bounds::PartitionBound
Bounds for an integer partition exponential mechanism invocation.
Fields
upper: Vec<i64>
The upper bounds (terminates with 0)
lower: Vec<i64>
The lower bounds (terminates with 0)
count: usize
Total count (bound)
cells: usize
Number of cells (bound)
sparsity_control: bool
Whether sparsity control is enforced
noisy_estimates: Option<Vec<f64>>
The noisy estimates used, if any
Implementations
impl PartitionBound
[src]
pub fn check(&self) -> Result<()>
[src]
Checks that the partition bounds are valid:
- Upper bound always greater than or equal to lower bound
- Terminating zeros
pub fn new(total_count: usize) -> Result<PartitionBound>
[src]
Get partition bounds for the given total count based on the naive
formula upper[i] <= total_count/i
, lower[i] >= 0
.
Arguments:
total_count
: upper bound on the total count
Returns
A PartitionBound
constructed via the naive formula.
pub fn with_cells(
total_count: usize,
total_cells: usize
) -> Result<PartitionBound>
[src]
total_count: usize,
total_cells: usize
) -> Result<PartitionBound>
Get partition bounds for the given by the naive formula for total_count
,
with maximum length dictated by total_cells
.
Arguments:
total_count
: the total size of the partition.total_cells
: (upper bound on) the total number of cells/length of the partition.
pub fn from_dist(
d: usize,
x: &Vec<i64>,
total_count: usize,
total_cells: usize
) -> Result<PartitionBound>
[src]
d: usize,
x: &Vec<i64>,
total_count: usize,
total_cells: usize
) -> Result<PartitionBound>
Returns partition bounds of distance at most d
from the given partition x
.
For appropriately derived d
, these bounds can be used to implement the
approximately differentially private integer partition mechanism of
Bocki, Datta and Bonneau '16.
Arguments:
d
: the distance boundx
: the partitiontotal_count
: an upper bound on the total size of the partitiontotal_cells
: an upper bound on the total number of cells
pub fn with_reference(
_total_count: usize,
_ref: &Vec<i64>,
_x: &Vec<i64>,
_eta: Eta
) -> Result<PartitionBound>
[src]
_total_count: usize,
_ref: &Vec<i64>,
_x: &Vec<i64>,
_eta: Eta
) -> Result<PartitionBound>
Get bounds based on a reference partition using budget to compute the dist from the reference to set the bounds.
TODO: not implemented;
Arguments
ref_partition
: the reference partition to base the bounds on.x
: the target (private) integer partition.eta
: the privacy budget to compute a noisy estimate of the dist betweenref_partition
and the target partitionx
.
x
and r
are expected to be the same length and to have roughly the same size.
Returns
Computes a noisy estimate of the dist between r
and x
and returns an pair of partition
bounds of length ref_partition.len()+1
(for trailing zero pair),
which are ~centered on the provided reference r
and include all integer partitions within
the estimated noisy distance.
pub fn from_noisy_estimates<R: ThreadRandGen + Copy>(
total_count: usize,
total_cells: Option<usize>,
x: &Vec<i64>,
eta: Eta,
rng: R,
options: PartitionBoundOptions
) -> Result<PartitionBound>
[src]
total_count: usize,
total_cells: Option<usize>,
x: &Vec<i64>,
eta: Eta,
rng: R,
options: PartitionBoundOptions
) -> Result<PartitionBound>
Partition bounds from noisy estimates
Arguments
total_count
: upper bound on the total counttotal_cells
: an optional upper bound on the total cells (otherwisetotal_count
is used)x
: the target (private) integer partitioneta
: the privacy budget for computing the noisy estimatesoptions
: a set ofPartitionBoundOptions
including options for exponential mechanism invocations, padding options for noisy estimates, an optional additional privacy budget for sparsity control. If the noisy sparsity control estimate indicates more cells thantotal_cells
if provided,total_cells
is used.
Example Usage
use b2dp::{Eta, GeneratorOpenSSL, utilities::bounds::{PartitionBound, PartitionBoundOptions}}; let rng = GeneratorOpenSSL {}; let eta = Eta::new(1,1,1).unwrap(); let x: Vec<i64> = vec![5,4,3,2,1,0]; let total_count = 15; let total_cells = None; let options: PartitionBoundOptions = Default::default(); let pb = PartitionBound::from_noisy_estimates(total_count, total_cells, &x, eta, rng, options);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PartitionBound
impl Send for PartitionBound
impl Sync for PartitionBound
impl Unpin for PartitionBound
impl UnwindSafe for PartitionBound
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OverflowingAs for T
[src]
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> SaturatingAs for T
[src]
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
impl<T> StaticAs for T
[src]
fn static_as<Dst>(self) -> Option<Dst> where
T: StaticCast<Dst>,
[src]
T: StaticCast<Dst>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WrappingAs for T
[src]
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,