Small clean up
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
extern crate blas_src;
|
||||
|
||||
use kickscore as ks;
|
||||
use kickscore::{
|
||||
kernel::{self, Kernel},
|
||||
model::{binary, Binary},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let mut model = ks::model::Binary::new(ks::model::binary::Observation::Probit);
|
||||
let mut model = Binary::new(binary::Observation::Probit);
|
||||
|
||||
// Spike's skill does not change over time.
|
||||
let k_spike = ks::kernel::Constant::new(0.5);
|
||||
let k_spike = kernel::Constant::new(0.5);
|
||||
|
||||
// Tom's skill changes over time, with "jagged" (non-smooth) dynamics.
|
||||
let k_tom = ks::kernel::Exponential::new(1.0, 1.0);
|
||||
let k_tom = kernel::Exponential::new(1.0, 1.0);
|
||||
|
||||
// Jerry's skill has a constant offset and smooth dynamics.
|
||||
let k_jerry: [Box<dyn ks::Kernel>; 2] = [
|
||||
Box::new(ks::kernel::Constant::new(1.0)),
|
||||
Box::new(ks::kernel::Matern52::new(0.5, 1.0)),
|
||||
let k_jerry: [Box<dyn Kernel>; 2] = [
|
||||
Box::new(kernel::Constant::new(1.0)),
|
||||
Box::new(kernel::Matern52::new(0.5, 1.0)),
|
||||
];
|
||||
|
||||
// Now we are ready to add the items in the model.
|
||||
|
||||
@@ -2,6 +2,26 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::item::Item;
|
||||
|
||||
/*
|
||||
pub trait Storage {
|
||||
type Key;
|
||||
|
||||
type IterKeys:
|
||||
type IterItems:
|
||||
type IterItemsMut:
|
||||
|
||||
fn contains_key(&self, key: Self::Key) -> bool;
|
||||
fn insert(&mut self, key: Self::Key, item: Item);
|
||||
fn get_id(&self, key: Self::Key) -> usize;
|
||||
fn get_item(&mut self, id: usize) -> &mut Item;
|
||||
fn item(&self, id: usize) -> &Item;
|
||||
fn item_mut(&mut self, id: usize) -> &mut Item;
|
||||
fn items(&self) -> impl Iterator<Item = &Item>;
|
||||
fn items_mut(&mut self) -> impl Iterator<Item = &mut Item>;
|
||||
fn keys(&self) -> impl Iterator<Item = &String>;
|
||||
}
|
||||
*/
|
||||
|
||||
pub struct Storage {
|
||||
keys: HashMap<String, usize>,
|
||||
items: Vec<Item>,
|
||||
|
||||
Reference in New Issue
Block a user