pub struct PrivacyMechanism {
pub noise_scale: f64,
}Expand description
Privacy mechanism for federated learning
Fields§
§noise_scale: f64Noise scale for differential privacy
Implementations§
Source§impl PrivacyMechanism
impl PrivacyMechanism
Sourcepub fn apply_noise(&self, gradients: &mut [f64], epsilon: f64)
pub fn apply_noise(&self, gradients: &mut [f64], epsilon: f64)
Apply differential privacy noise to gradients
Sourcepub fn clip_gradients(&self, gradients: &mut [f64], clip_norm: f64)
pub fn clip_gradients(&self, gradients: &mut [f64], clip_norm: f64)
Clip gradients for privacy preservation
Trait Implementations§
Source§impl Clone for PrivacyMechanism
impl Clone for PrivacyMechanism
Source§fn clone(&self) -> PrivacyMechanism
fn clone(&self) -> PrivacyMechanism
Returns a duplicate 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 PrivacyMechanism
impl Debug for PrivacyMechanism
Auto Trait Implementations§
impl Freeze for PrivacyMechanism
impl RefUnwindSafe for PrivacyMechanism
impl Send for PrivacyMechanism
impl Sync for PrivacyMechanism
impl Unpin for PrivacyMechanism
impl UnwindSafe for PrivacyMechanism
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more