RecommendationEngine

Trait RecommendationEngine 

Source
pub trait RecommendationEngine: Debug {
    // Required methods
    fn recommend(
        &self,
        user_id: usize,
        n_items: usize,
        exclude_seen: bool,
    ) -> Result<Vec<Recommendation>>;
    fn update(
        &mut self,
        user_id: usize,
        item_id: usize,
        rating: f64,
    ) -> Result<()>;
    fn compute_similarity(
        &self,
        id1: usize,
        id2: usize,
        similarity_type: SimilarityType,
    ) -> Result<f64>;
    fn parameters(&self) -> &Array1<f64>;
    fn clone_box(&self) -> Box<dyn RecommendationEngine>;
}
Expand description

Item features

Required Methods§

Source

fn recommend( &self, user_id: usize, n_items: usize, exclude_seen: bool, ) -> Result<Vec<Recommendation>>

Generate recommendations for a user

Source

fn update(&mut self, user_id: usize, item_id: usize, rating: f64) -> Result<()>

Update model with new interaction

Source

fn compute_similarity( &self, id1: usize, id2: usize, similarity_type: SimilarityType, ) -> Result<f64>

Compute similarity between users or items

Source

fn parameters(&self) -> &Array1<f64>

Get model parameters

Source

fn clone_box(&self) -> Box<dyn RecommendationEngine>

Clone the engine

Trait Implementations§

Source§

impl Clone for Box<dyn RecommendationEngine>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§