Struct recoreco::stats::DataDictionary
source · pub struct DataDictionary { /* private fields */ }
Expand description
Mapping from original string based identifiers to internal u32
indexes.
Implementations§
source§impl DataDictionary
impl DataDictionary
sourcepub fn num_interactions(&self) -> u64
pub fn num_interactions(&self) -> u64
Returns the overall number of interactions in the dataset.
sourcepub fn user_index(&self, name: &str) -> &u32
pub fn user_index(&self, name: &str) -> &u32
Returns the internal index for the user with the string identifier name
sourcepub fn item_index(&self, name: &str) -> &u32
pub fn item_index(&self, name: &str) -> &u32
Returns the internal index for the item with the string identifier name
sourcepub fn from_owned<T>(interactions: T) -> Selfwhere
T: Iterator<Item = (String, String)>,
pub fn from_owned<T>(interactions: T) -> Selfwhere
T: Iterator<Item = (String, String)>,
Builds up a DataDictionary
by consuming an iterator over string tuples representing
user-item interactions. We assume that the first string in the tuple identifies a user and
the second string identifies an item
sourcepub fn from<'a, T>(interactions: T) -> DataDictionarywhere
T: Iterator<Item = &'a (String, String)>,
pub fn from<'a, T>(interactions: T) -> DataDictionarywhere
T: Iterator<Item = &'a (String, String)>,
Builds up a DataDictionary
by reading an iterator over references to string tuples
representing user-item interactions. We assume that the first string in the tuple
identifies a user and the second string identifies an item
Trait Implementations§
source§impl From<DataDictionary> for Renaming
impl From<DataDictionary> for Renaming
Consume a DataDictionary to produce a Renaming for the reverse mapping