Struct opendp::metrics::DiscreteDistance
source · pub struct DiscreteDistance;
Expand description
Indicates if two elements are equal to each other.
This is used in the context of randomized response, to capture the distance between adjacent inputs (they are either equivalent or not).
§Proof Definition
§d
-closeness
For any two datasets $u, v \in$ AtomDomain<T>
and any $d$ of type IntDistance
,
we say that $u, v$ are $d$-close under the discrete metric (abbreviated as $d_{Eq}$) whenever
d_{Eq}(u, v) = \mathbb{1}[u = v] \leq d
§Notes
Clearly, d
is bounded above by 1.
1 is the expected argument on measurements that use this distance.
§Compatible Domains
AtomDomain<T>
for any validT
.
Trait Implementations§
source§impl Clone for DiscreteDistance
impl Clone for DiscreteDistance
source§fn clone(&self) -> DiscreteDistance
fn clone(&self) -> DiscreteDistance
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DiscreteDistance
impl Debug for DiscreteDistance
source§impl Default for DiscreteDistance
impl Default for DiscreteDistance
Auto Trait Implementations§
impl Freeze for DiscreteDistance
impl RefUnwindSafe for DiscreteDistance
impl Send for DiscreteDistance
impl Sync for DiscreteDistance
impl Unpin for DiscreteDistance
impl UnwindSafe for DiscreteDistance
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.