[][src]Struct b2dp::utilities::bounds::PartitionBound

pub struct PartitionBound {
    pub upper: Vec<i64>,
    pub lower: Vec<i64>,
    pub count: usize,
    pub cells: usize,
    pub sparsity_control: bool,
    pub noisy_estimates: Option<Vec<f64>>,
}

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]

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]

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 bound
  • x: the partition
  • total_count: an upper bound on the total size of the partition
  • total_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]

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 between ref_partition and the target partition x.

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]

Partition bounds from noisy estimates

Arguments

  • total_count: upper bound on the total count
  • total_cells: an optional upper bound on the total cells (otherwise total_count is used)
  • x: the target (private) integer partition
  • eta: the privacy budget for computing the noisy estimates
  • options: a set of PartitionBoundOptions 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 than total_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

impl Debug for PartitionBound[src]

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]

impl<T> Az for T[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedAs for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> OverflowingAs for T[src]

impl<T> SaturatingAs for T[src]

impl<T> StaticAs for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WrappingAs for T[src]