pub struct TropicalNeuralAnalysis { /* private fields */ }Expand description
Analyzes ReLU neural networks using tropical geometry
Implementations§
Source§impl TropicalNeuralAnalysis
impl TropicalNeuralAnalysis
Sourcepub fn new(
architecture: Vec<usize>,
weights: Vec<Vec<Vec<f64>>>,
biases: Vec<Vec<f64>>,
) -> Self
pub fn new( architecture: Vec<usize>, weights: Vec<Vec<Vec<f64>>>, biases: Vec<Vec<f64>>, ) -> Self
Create analyzer for a ReLU network
Sourcepub fn linear_region_upper_bound(&self) -> u128
pub fn linear_region_upper_bound(&self) -> u128
Upper bound on number of linear regions
For a network with widths n_0, n_1, …, n_L where n_0 is input dimension: Upper bound = prod_{i=1}^{L-1} sum_{j=0}^{min(n_0, n_i)} C(n_i, j)
This follows from tropical geometry considerations.
Sourcepub fn estimate_linear_regions(&self, num_samples: usize, seed: u64) -> usize
pub fn estimate_linear_regions(&self, num_samples: usize, seed: u64) -> usize
Estimate actual linear regions by sampling
Samples random points and counts how many distinct activation patterns occur.
Sourcepub fn as_tropical_polynomial_1d(&self) -> Option<TropicalPolynomial>
pub fn as_tropical_polynomial_1d(&self) -> Option<TropicalPolynomial>
Compute the tropical polynomial representation for 1D input Returns the piecewise linear function f(x)
Sourcepub fn decision_boundary_complexity(&self, num_samples: usize, seed: u64) -> f64
pub fn decision_boundary_complexity(&self, num_samples: usize, seed: u64) -> f64
Compute decision boundary complexity for binary classification
Trait Implementations§
Source§impl Clone for TropicalNeuralAnalysis
impl Clone for TropicalNeuralAnalysis
Source§fn clone(&self) -> TropicalNeuralAnalysis
fn clone(&self) -> TropicalNeuralAnalysis
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 moreAuto Trait Implementations§
impl Freeze for TropicalNeuralAnalysis
impl RefUnwindSafe for TropicalNeuralAnalysis
impl Send for TropicalNeuralAnalysis
impl Sync for TropicalNeuralAnalysis
impl Unpin for TropicalNeuralAnalysis
impl UnwindSafe for TropicalNeuralAnalysis
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