Add method to check if item already has been added.

This commit is contained in:
2020-02-24 21:49:54 +01:00
parent 9b79722984
commit c799479b78

View File

@@ -47,6 +47,10 @@ impl BinaryModel {
); );
} }
pub fn contains_item(&self, name: &str) -> bool {
self.storage.contains_key(name)
}
pub fn item_score(&self, name: &str, t: f64) -> (f64, f64) { pub fn item_score(&self, name: &str, t: f64) -> (f64, f64) {
let id = self.storage.get_id(name); let id = self.storage.get_id(name);
let (ms, vs) = self.storage.item(id).fitter.predict(&[t]); let (ms, vs) = self.storage.item(id).fitter.predict(&[t]);