pub struct FSRS<B: Backend = NdArray> { /* private fields */ }Expand description
This is the main structure provided by this crate. It can be used for both parameter training, and for reviews.
Implementations§
Source§impl<B: Backend> FSRS<B>
impl<B: Backend> FSRS<B>
Sourcepub fn memory_state(
&self,
item: FSRSItem,
starting_state: Option<MemoryState>,
) -> Result<MemoryState>
pub fn memory_state( &self, item: FSRSItem, starting_state: Option<MemoryState>, ) -> Result<MemoryState>
Calculate the current memory state for a given card’s history of reviews.
In the case of truncated reviews, starting_state can be set to the value of
FSRS::memory_state_from_sm2 for the first review (which should not be included
in FSRSItem). If not provided, the card starts as new.
Parameters must have been provided when calling FSRS::new().
Sourcepub fn memory_state_from_sm2(
&self,
ease_factor: f32,
interval: f32,
sm2_retention: f32,
) -> Result<MemoryState>
pub fn memory_state_from_sm2( &self, ease_factor: f32, interval: f32, sm2_retention: f32, ) -> Result<MemoryState>
If a card has incomplete learning history, memory state can be approximated from current sm2 values. Parameters must have been provided when calling FSRS::new().
Sourcepub fn next_interval(
&self,
stability: Option<f32>,
desired_retention: f32,
rating: u32,
) -> f32
pub fn next_interval( &self, stability: Option<f32>, desired_retention: f32, rating: u32, ) -> f32
Calculate the next interval for the current memory state, for rescheduling. Stability should be provided except when the card is new. Rating is ignored except when card is new. Parameters must have been provided when calling FSRS::new().
Sourcepub fn next_states(
&self,
current_memory_state: Option<MemoryState>,
desired_retention: f32,
days_elapsed: u32,
) -> Result<NextStates>
pub fn next_states( &self, current_memory_state: Option<MemoryState>, desired_retention: f32, days_elapsed: u32, ) -> Result<NextStates>
The intervals and memory states for each answer button. Parameters must have been provided when calling FSRS::new().
Sourcepub fn evaluate<F>(
&self,
items: Vec<FSRSItem>,
progress: F,
) -> Result<ModelEvaluation>
pub fn evaluate<F>( &self, items: Vec<FSRSItem>, progress: F, ) -> Result<ModelEvaluation>
Determine how well the model and parameters predict performance. Parameters must have been provided when calling FSRS::new().
Sourcepub fn current_retrievability(
&self,
state: MemoryState,
days_elapsed: u32,
) -> f32
pub fn current_retrievability( &self, state: MemoryState, days_elapsed: u32, ) -> f32
How well the user is likely to remember the item after days_elapsed since the previous
review.
Sourcepub fn universal_metrics<F>(
&self,
items: Vec<FSRSItem>,
parameters: &[f32],
progress: F,
) -> Result<(f32, f32)>
pub fn universal_metrics<F>( &self, items: Vec<FSRSItem>, parameters: &[f32], progress: F, ) -> Result<(f32, f32)>
Returns the universal metrics for the existing and provided parameters. If the first value is smaller than the second value, the existing parameters are better than the provided ones.
Source§impl<B: Backend> FSRS<B>
impl<B: Backend> FSRS<B>
Sourcepub fn optimal_retention<F>(
&self,
config: &SimulatorConfig,
parameters: &[f32],
progress: F,
) -> Result<f32>
pub fn optimal_retention<F>( &self, config: &SimulatorConfig, parameters: &[f32], progress: F, ) -> Result<f32>
For the given simulator parameters and parameters, determine the suggested desired_retention
value.
Source§impl<B: Backend> FSRS<B>
impl<B: Backend> FSRS<B>
Sourcepub fn compute_parameters(
&self,
train_set: Vec<FSRSItem>,
progress: Option<Arc<Mutex<CombinedProgressState>>>,
enable_short_term: bool,
) -> Result<Vec<f32>>
pub fn compute_parameters( &self, train_set: Vec<FSRSItem>, progress: Option<Arc<Mutex<CombinedProgressState>>>, enable_short_term: bool, ) -> Result<Vec<f32>>
Calculate appropriate parameters for the provided review history.
pub fn benchmark( &self, train_set: Vec<FSRSItem>, enable_short_term: bool, ) -> Vec<f32>
Trait Implementations§
Auto Trait Implementations§
impl<B = NdArray> !Freeze for FSRS<B>
impl<B = NdArray> !RefUnwindSafe for FSRS<B>
impl<B> Send for FSRS<B>
impl<B = NdArray> !Sync for FSRS<B>
impl<B> Unpin for FSRS<B>
impl<B> UnwindSafe for FSRS<B>
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