Struct oozie::recommender::KNNItemRecommender
[−]
[src]
pub struct KNNItemRecommender<'a, D: DataHandler + 'a> { /* fields omitted */ }
An item based nearest neighbors recommender
Methods
impl<'a, D: DataHandler + 'a> KNNItemRecommender<'a, D>
[src]
fn new(
data_handler: &mut D,
k: usize,
similarity: fn(_: &HashMap<usize, f64>, _: &HashMap<usize, f64>, _: usize) -> f64
) -> KNNItemRecommender<D>
data_handler: &mut D,
k: usize,
similarity: fn(_: &HashMap<usize, f64>, _: &HashMap<usize, f64>, _: usize) -> f64
) -> KNNItemRecommender<D>
Initializes a new recommender from a data handler, computes and stores the similarities between items
fn add_user(&mut self, user_id: ID) -> bool
Adds an user to the data handler
fn add_item(&mut self, item_id: ID) -> bool
Adds an item to the data handler
fn add_rating(&mut self, user_id: ID, item_id: ID, rating: f64) -> bool
Adds a rating to the data handler, it computes the similarities for the item which had a new rating
Trait Implementations
impl<'a, D: DataHandler + 'a> Recommender for KNNItemRecommender<'a, D>
[src]
fn predict(&self, user_id: ID, item_id: ID) -> f64
Predicts a rating given an user and an item.
fn recommend(&self, user_id: ID) -> Vec<(ID, f64)>
Generates a sorted vector of item IDs by a predicted rating which is computed in the same way that the predict method. It ignores items that have a predicted rating of -1.0