Small fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
extern crate intel_mkl_src;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
use std::io::{self, BufRead};
|
||||
@@ -39,12 +40,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let score_1: u16 = data[3].parse()?;
|
||||
let score_2: u16 = data[4].parse()?;
|
||||
|
||||
if score_1 > score_2 {
|
||||
match score_1.cmp(&score_2) {
|
||||
Ordering::Greater => {
|
||||
observations.push((data[1].to_string(), data[2].to_string(), t));
|
||||
} else if score_1 < score_2 {
|
||||
}
|
||||
Ordering::Less => {
|
||||
observations.push((data[2].to_string(), data[1].to_string(), t));
|
||||
} else {
|
||||
panic!("there shouldn't be any tie games");
|
||||
}
|
||||
_ => panic!("there shouldn't be any tie games"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,7 @@ use crate::storage::Storage;
|
||||
|
||||
use super::Observation;
|
||||
|
||||
pub struct GaussianObservation {
|
||||
/*
|
||||
m: usize,
|
||||
items: Vec<usize>,
|
||||
coeffs: Vec<f64>,
|
||||
indices: Vec<usize>,
|
||||
ns_cav: Vec<f64>,
|
||||
xs_cav: Vec<f64>,
|
||||
t: f64,
|
||||
logpart: f64,
|
||||
exp_ll: usize,
|
||||
margin: f64,
|
||||
*/}
|
||||
pub struct GaussianObservation;
|
||||
|
||||
impl GaussianObservation {
|
||||
pub fn new(
|
||||
|
||||
28
tests/binary-1.rs
Normal file
28
tests/binary-1.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
extern crate intel_mkl_src;
|
||||
|
||||
use approx::assert_abs_diff_eq;
|
||||
use kickscore as ks;
|
||||
|
||||
#[test]
|
||||
fn binary_1() {
|
||||
let mut model = ks::BinaryModel::new(ks::BinaryModelObservation::Probit);
|
||||
|
||||
let k_audrey = ks::kernel::Matern52::new(1.0, 2.0);
|
||||
let k_benjamin = ks::kernel::Matern52::new(1.0, 2.0);
|
||||
|
||||
model.add_item("audrey", Box::new(k_audrey));
|
||||
model.add_item("benjamin", Box::new(k_benjamin));
|
||||
|
||||
model.observe(&["audrey"], &["benjamin"], 0.0);
|
||||
model.observe(&["audrey"], &["benjamin"], 1.0);
|
||||
model.observe(&["audrey"], &["benjamin"], 2.0);
|
||||
|
||||
model.observe(&["audrey"], &["benjamin"], 3.0);
|
||||
|
||||
model.observe(&["benjamin"], &["audrey"], 4.0);
|
||||
model.observe(&["benjamin"], &["audrey"], 5.0);
|
||||
model.observe(&["benjamin"], &["audrey"], 6.0);
|
||||
model.observe(&["benjamin"], &["audrey"], 7.0);
|
||||
|
||||
model.fit();
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
extern crate intel_mkl_src;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
use std::io::{self, BufRead};
|
||||
@@ -43,12 +44,14 @@ fn nba_history() {
|
||||
let score_1: u16 = data[3].parse().unwrap();
|
||||
let score_2: u16 = data[4].parse().unwrap();
|
||||
|
||||
if score_1 > score_2 {
|
||||
match score_1.cmp(&score_2) {
|
||||
Ordering::Greater => {
|
||||
observations.push((data[1].to_string(), data[2].to_string(), t));
|
||||
} else if score_1 < score_2 {
|
||||
}
|
||||
Ordering::Less => {
|
||||
observations.push((data[2].to_string(), data[1].to_string(), t));
|
||||
} else {
|
||||
panic!("there shouldn't be any tie games");
|
||||
}
|
||||
_ => panic!("there shouldn't be any tie games"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user