Struct nblast::ScoreMatrixBuilder
source · pub struct ScoreMatrixBuilder<T: TargetNeuron> { /* private fields */ }
Expand description
Calculate a score matrix (lookup table for converting point matches into NBLAST scores) from real data using some sets of matching and non-matching neurons.
At a minimum, one matching set must be added (.add_matching_set
),
and the dist and dot bins must either be set automatically or calculated
(.set_(n_)?(dist|dot)_bins
).
Implementations§
source§impl<T: TargetNeuron + Sync> ScoreMatrixBuilder<T>
impl<T: TargetNeuron + Sync> ScoreMatrixBuilder<T>
sourcepub fn new(neurons: Vec<T>, seed: u64) -> Self
pub fn new(neurons: Vec<T>, seed: u64) -> Self
seed
is used when randomly selecting non-matching neurons to use as controls.
sourcepub fn add_matching_set(&mut self, matching: &[usize]) -> &mut Self
pub fn add_matching_set(&mut self, matching: &[usize]) -> &mut Self
Add a set of neurons which are considered to be mutually matching,
as indices into the ScoreMatrixBuilder.neurons
.
This can be done several times with different sets.
Matching sets should be small subsets of the total neuron count.
Indices outside of the neuron vec will be silently filtered out. Filtered sets with length <2 will also be silently ignored.
sourcepub fn add_nonmatching_set(&mut self, nonmatching: &[usize]) -> &mut Self
pub fn add_nonmatching_set(&mut self, nonmatching: &[usize]) -> &mut Self
Optionally list neuron sets which are mutually non-matching,
as indices into ScoreMatrixBuilder.neurons
,
from which non-matching pairs will be randomly drawn.
By default, all neurons are included,
as matching sets are expected to be only a small portion of the total neurons.
Candidate non-matching pairs are made sure not to be in the matching pairs, so this can safely be ignored.
sourcepub fn set_use_alpha(&mut self, use_alpha: bool) -> &mut Self
pub fn set_use_alpha(&mut self, use_alpha: bool) -> &mut Self
Alpha values are a measure of how colinear a neuron’s local neighborhood is. Score matrices calculated using alpha can only be used for queries using alpha, and vice versa.
False by default.
sourcepub fn set_dist_lookup(&mut self, lookup: BinLookup<Precision>) -> &mut Self
pub fn set_dist_lookup(&mut self, lookup: BinLookup<Precision>) -> &mut Self
Manually set the lookup bins for distances.
Consider BinLookup::new_exp
here.
sourcepub fn set_n_dist_bins(&mut self, n_bins: usize) -> &mut Self
pub fn set_n_dist_bins(&mut self, n_bins: usize) -> &mut Self
Automatically generate distance bins by by using distances from matching sets.
sourcepub fn set_dot_lookup(&mut self, lookup: BinLookup<Precision>) -> &mut Self
pub fn set_dot_lookup(&mut self, lookup: BinLookup<Precision>) -> &mut Self
Manually set the lookup bins for dot products.
Consider BinLookup::new_linear(0.0, 1.0, n_bins, (true, true))
here.
sourcepub fn set_n_dot_bins(&mut self, n_bins: usize) -> &mut Self
pub fn set_n_dot_bins(&mut self, n_bins: usize) -> &mut Self
Automatically generate abs dot product bins by using dot products from matching sets.
sourcepub fn set_max_matching_pairs(&mut self, n_pairs: usize) -> &mut Self
pub fn set_max_matching_pairs(&mut self, n_pairs: usize) -> &mut Self
Draw at most this many matching pairs from the given matching sets. May be fewer if there aren’t that many combinations. By default, uses all possible pairs.
sourcepub fn set_max_nonmatching_pairs(&mut self, n_pairs: usize) -> &mut Self
pub fn set_max_nonmatching_pairs(&mut self, n_pairs: usize) -> &mut Self
Draw at most this many nonmatching pairs from the given nonmatching sets. May be fewer if there aren’t that many combinations. By default, uses as many pairs as for matching.
Auto Trait Implementations§
impl<T> RefUnwindSafe for ScoreMatrixBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for ScoreMatrixBuilder<T>where
T: Send,
impl<T> Sync for ScoreMatrixBuilder<T>where
T: Sync,
impl<T> Unpin for ScoreMatrixBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for ScoreMatrixBuilder<T>where
T: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.