pub struct AdversarialGraphLearning {
pub k_neighbors: usize,
pub robustness_lambda: f64,
pub max_perturbation: f64,
pub adversarial_steps: usize,
pub adversarial_lr: f64,
pub defense_strategy: String,
pub consensus_threshold: f64,
pub max_iter: usize,
pub tolerance: f64,
pub random_state: Option<u64>,
}Expand description
Adversarial graph learning for robust semi-supervised learning
Fields§
§k_neighbors: usizeNumber of neighbors for graph construction
robustness_lambda: f64Robustness parameter for adversarial defense
max_perturbation: f64Maximum perturbation magnitude allowed
adversarial_steps: usizeNumber of adversarial iterations
adversarial_lr: f64Learning rate for adversarial updates
defense_strategy: StringDefense strategy: “spectral”, “robust_pca”, “consensus”, “adaptive”
consensus_threshold: f64Consensus threshold for agreement-based defense
max_iter: usizeMaximum iterations for optimization
tolerance: f64Convergence tolerance
random_state: Option<u64>Random state for reproducibility
Implementations§
Source§impl AdversarialGraphLearning
impl AdversarialGraphLearning
Sourcepub fn k_neighbors(self, k: usize) -> Self
pub fn k_neighbors(self, k: usize) -> Self
Set the number of neighbors for graph construction
Sourcepub fn robustness_lambda(self, lambda: f64) -> Self
pub fn robustness_lambda(self, lambda: f64) -> Self
Set the robustness parameter
Sourcepub fn max_perturbation(self, max_pert: f64) -> Self
pub fn max_perturbation(self, max_pert: f64) -> Self
Set the maximum perturbation magnitude
Sourcepub fn adversarial_steps(self, steps: usize) -> Self
pub fn adversarial_steps(self, steps: usize) -> Self
Set the number of adversarial steps
Sourcepub fn adversarial_lr(self, lr: f64) -> Self
pub fn adversarial_lr(self, lr: f64) -> Self
Set the adversarial learning rate
Sourcepub fn defense_strategy(self, strategy: String) -> Self
pub fn defense_strategy(self, strategy: String) -> Self
Set the defense strategy
Sourcepub fn consensus_threshold(self, threshold: f64) -> Self
pub fn consensus_threshold(self, threshold: f64) -> Self
Set the consensus threshold
Sourcepub fn random_state(self, seed: u64) -> Self
pub fn random_state(self, seed: u64) -> Self
Set the random state
Sourcepub fn fit_robust(
&self,
features: ArrayView2<'_, f64>,
labels: Option<ArrayView1<'_, i32>>,
) -> Result<Array2<f64>, SklearsError>
pub fn fit_robust( &self, features: ArrayView2<'_, f64>, labels: Option<ArrayView1<'_, i32>>, ) -> Result<Array2<f64>, SklearsError>
Learn a robust graph in the presence of adversarial perturbations
Sourcepub fn apply_attack(
&self,
features: ArrayView2<'_, f64>,
attack: &AdversarialAttack,
) -> Result<Array2<f64>, SklearsError>
pub fn apply_attack( &self, features: ArrayView2<'_, f64>, attack: &AdversarialAttack, ) -> Result<Array2<f64>, SklearsError>
Apply adversarial attack to test robustness
Sourcepub fn evaluate_robustness(
&self,
original_graph: &Array2<f64>,
attacked_graph: &Array2<f64>,
) -> Result<f64, SklearsError>
pub fn evaluate_robustness( &self, original_graph: &Array2<f64>, attacked_graph: &Array2<f64>, ) -> Result<f64, SklearsError>
Evaluate robustness against attack
Trait Implementations§
Source§impl Clone for AdversarialGraphLearning
impl Clone for AdversarialGraphLearning
Source§fn clone(&self) -> AdversarialGraphLearning
fn clone(&self) -> AdversarialGraphLearning
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AdversarialGraphLearning
impl RefUnwindSafe for AdversarialGraphLearning
impl Send for AdversarialGraphLearning
impl Sync for AdversarialGraphLearning
impl Unpin for AdversarialGraphLearning
impl UnwindSafe for AdversarialGraphLearning
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
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>
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>
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