pub struct RtModel { /* private fields */ }Expand description
A loaded RT model plus a content fingerprint (a stable hash of the model
file bytes). The fingerprint keys the on-disk prediction cache
(crate::rt_cache) so cached predictions are reused only for the exact
model that produced them.
Implementations§
Source§impl RtModel
impl RtModel
Sourcepub fn cnn_info(&self) -> Option<&Value>
pub fn cnn_info(&self) -> Option<&Value>
CNN provenance when available; legacy backends have no CNN metadata.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self>
pub fn load(path: impl AsRef<Path>) -> Result<Self>
Load a distilled RT model, auto-detecting the backend by file magic:
a leading UMLP => MLP, URTC => CNN, otherwise the gbdt-rs JSON format.
Sourcepub fn fingerprint(&self) -> u64
pub fn fingerprint(&self) -> u64
Stable content hash of the model file, used as the prediction-cache key.
Sourcepub fn predict_seq(&self, seq: &str) -> f64
pub fn predict_seq(&self, seq: &str) -> f64
Predict abstract RT for one sequence.
Sourcepub fn embed_many<S: AsRef<str> + Sync>(
&self,
seqs: &[S],
) -> Option<Vec<Vec<f64>>>
pub fn embed_many<S: AsRef<str> + Sync>( &self, seqs: &[S], ) -> Option<Vec<Vec<f64>>>
Penultimate-layer embeddings for fine-tuning the readout on-data. Only the
MLP/CNN backends expose a usable embedding; the gbdt student returns None.
Sourcepub fn predict_embed_many<S: AsRef<str> + Sync>(
&self,
seqs: &[S],
) -> (Vec<f64>, Option<Vec<Vec<f64>>>)
pub fn predict_embed_many<S: AsRef<str> + Sync>( &self, seqs: &[S], ) -> (Vec<f64>, Option<Vec<Vec<f64>>>)
Predict abstract RT AND return the penultimate embedding per sequence in a
single pass, when the on-data RT fine-tune will consume both. Returns
(preds, Some(embeds)) for backends with a usable embedding (MLP/CNN) and
(preds, None) for the gbdt student. Byte-identical to calling
predict_many and embed_many separately, but the CNN backend runs its
forward pass once instead of twice over the same ~1.1M unique peptides.
Auto Trait Implementations§
impl Freeze for RtModel
impl RefUnwindSafe for RtModel
impl Send for RtModel
impl Sync for RtModel
impl Unpin for RtModel
impl UnsafeUnpin for RtModel
impl UnwindSafe for RtModel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.