[−][src]Struct gmarkov_lib::MarkovChain
The Markov Chain data structure
A Markov chain is a statistical model that is used to predict random sequences based on the probability of one symbol coming after another. For a basic introduction you can read this article. For a more technical overview you can read the wikipedia article on the subject.
Items in markov chains in gmarkov-lib
must implement the Eq
, Hash
, and
Clone
traits for use.
Methods
impl<I: ChainItem> MarkovChain<I>
[src]
pub fn with_order<T>(order: usize) -> MarkovChain<I>
[src]
Create a Markov chain with order order
.
The order specifies how many steps back in the sequence the chain keeps track of. A higher order allows for better results but also requires a much larger dataset.
pub fn feed(&mut self, input: impl Iterator<Item = I>)
[src]
Train the Markov chain by "feeding" it the iterator input
.
This adds the input to the current Markov chain. The generated output will resemble this input.
Trait Implementations
impl<I: Clone + ChainItem> Clone for MarkovChain<I>
[src]
fn clone(&self) -> MarkovChain<I>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<I: ChainItem> IntoIterator for MarkovChain<I>
[src]
type Item = I
The type of the elements being iterated over.
type IntoIter = MarkovIterator<I>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Transform the Markov chain into an iterator.
You will usually want to clone the Markov chain before turning it into an iterator so that you don't have to retrain it every time.
impl<I: Debug + ChainItem> Debug for MarkovChain<I>
[src]
Auto Trait Implementations
impl<I> Send for MarkovChain<I> where
I: Send,
I: Send,
impl<I> Sync for MarkovChain<I> where
I: Sync,
I: Sync,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,