Struct sbr::data::Interactions [−][src]
pub struct Interactions { /* fields omitted */ }
A collection of individual interactions.
Methods
impl Interactions
[src]
impl Interactions
pub fn new(num_users: usize, num_items: usize) -> Self
[src]
pub fn new(num_users: usize, num_items: usize) -> Self
Crate a new interactions object.
pub fn push(&mut self, interaction: Interaction)
[src]
pub fn push(&mut self, interaction: Interaction)
Add a new interaction.
pub fn data(&self) -> &[Interaction]
[src]
pub fn data(&self) -> &[Interaction]
Return the underlying data.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Give the number of contained interactions.
pub fn shuffle<R: Rng>(&mut self, rng: &mut R)
[src]
pub fn shuffle<R: Rng>(&mut self, rng: &mut R)
Shuffle the interactions in-place.
pub fn split_at(&self, idx: usize) -> (Self, Self)
[src]
pub fn split_at(&self, idx: usize) -> (Self, Self)
Split interactions at idx
.
pub fn split_by<F: Fn(&Interaction) -> bool>(&self, func: F) -> (Self, Self)
[src]
pub fn split_by<F: Fn(&Interaction) -> bool>(&self, func: F) -> (Self, Self)
Split interactions by predicate.
pub fn to_triplet(&self) -> TripletInteractions
[src]
pub fn to_triplet(&self) -> TripletInteractions
Covert to triplet representation.
pub fn to_compressed(&self) -> CompressedInteractions
[src]
pub fn to_compressed(&self) -> CompressedInteractions
Convert to compressed representation.
pub fn num_users(&self) -> usize
[src]
pub fn num_users(&self) -> usize
Return number of users.
pub fn num_items(&self) -> usize
[src]
pub fn num_items(&self) -> usize
Return number of items.
pub fn shape(&self) -> (usize, usize)
[src]
pub fn shape(&self) -> (usize, usize)
Return (num_users
, num_items
).
Trait Implementations
impl Clone for Interactions
[src]
impl Clone for Interactions
fn clone(&self) -> Interactions
[src]
fn clone(&self) -> Interactions
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Debug for Interactions
[src]
impl Debug for Interactions
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl From<Vec<Interaction>> for Interactions
[src]
impl From<Vec<Interaction>> for Interactions
fn from(data: Vec<Interaction>) -> Interactions
[src]
fn from(data: Vec<Interaction>) -> Interactions
Performs the conversion.
impl<'a> From<&'a Interactions> for CompressedInteractions
[src]
impl<'a> From<&'a Interactions> for CompressedInteractions
fn from(interactions: &Interactions) -> CompressedInteractions
[src]
fn from(interactions: &Interactions) -> CompressedInteractions
Performs the conversion.
impl<'a> From<&'a Interactions> for TripletInteractions
[src]
impl<'a> From<&'a Interactions> for TripletInteractions
fn from(interactions: &'a Interactions) -> Self
[src]
fn from(interactions: &'a Interactions) -> Self
Performs the conversion.
Auto Trait Implementations
impl Send for Interactions
impl Send for Interactions
impl Sync for Interactions
impl Sync for Interactions