Initial commit. Basic structure in place, need to implement logic.

This commit is contained in:
2020-02-06 10:01:43 +01:00
commit dc545e4063
9 changed files with 148 additions and 0 deletions

11
src/kernel.rs Normal file
View File

@@ -0,0 +1,11 @@
mod constant;
mod exponential;
mod matern52;
pub use constant::Constant;
pub use exponential::Exponential;
pub use matern52::Matern52;
pub trait Kernel {}
impl Kernel for Vec<Box<dyn Kernel>> {}

13
src/kernel/constant.rs Normal file
View File

@@ -0,0 +1,13 @@
use super::Kernel;
pub struct Constant {
var: f64,
}
impl Constant {
pub fn new(var: f64) -> Self {
Constant { var }
}
}
impl Kernel for Constant {}

14
src/kernel/exponential.rs Normal file
View File

@@ -0,0 +1,14 @@
use super::Kernel;
pub struct Exponential {
var: f64,
l_scale: f64,
}
impl Exponential {
pub fn new(var: f64, l_scale: f64) -> Self {
Exponential { var, l_scale }
}
}
impl Kernel for Exponential {}

14
src/kernel/matern52.rs Normal file
View File

@@ -0,0 +1,14 @@
use super::Kernel;
pub struct Matern52 {
var: f64,
l_scale: f64,
}
impl Matern52 {
pub fn new(var: f64, l_scale: f64) -> Self {
Matern52 { var, l_scale }
}
}
impl Kernel for Matern52 {}

6
src/lib.rs Normal file
View File

@@ -0,0 +1,6 @@
// https://github.com/lucasmaystre/kickscore/tree/master/kickscore
pub mod kernel;
mod model;
pub use kernel::Kernel;
pub use model::*;

23
src/model.rs Normal file
View File

@@ -0,0 +1,23 @@
use crate::kernel::Kernel;
pub struct BinaryModel {
//
}
impl BinaryModel {
pub fn add_item(&mut self, name: &str, kernel: impl Kernel) {
//
}
pub fn observe(&mut self, winners: &[&str], losers: &[&str], t: f64) {
//
}
pub fn fit(&mut self, verbose: bool) {
//
}
pub fn probabilities(&mut self, team1: &[&str], team2: &[&str], t: f64) -> (f64, f64) {
(0.0, 0.0)
}
}