Use consistent style [skip ci]
This commit is contained in:
@@ -3,16 +3,14 @@ extern crate libc;
|
||||
use std::os::raw::{c_char, c_double, c_float, c_int, c_longlong};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct MfNode
|
||||
{
|
||||
pub struct MfNode {
|
||||
pub u: c_int,
|
||||
pub v: c_int,
|
||||
pub r: c_float
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct MfProblem
|
||||
{
|
||||
pub struct MfProblem {
|
||||
pub m: c_int,
|
||||
pub n: c_int,
|
||||
pub nnz: c_longlong,
|
||||
@@ -40,8 +38,7 @@ pub struct MfParameter {
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct MfModel
|
||||
{
|
||||
pub struct MfModel {
|
||||
pub fun: c_int,
|
||||
pub m: c_int,
|
||||
pub n: c_int,
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::bindings::*;
|
||||
use crate::{Matrix, Model};
|
||||
|
||||
pub struct Params {
|
||||
param: MfParameter,
|
||||
param: MfParameter
|
||||
}
|
||||
|
||||
impl Params {
|
||||
@@ -10,7 +10,7 @@ impl Params {
|
||||
let mut param = unsafe { mf_get_default_param() };
|
||||
param.nr_bins = 25;
|
||||
Self {
|
||||
param,
|
||||
param
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ impl Params {
|
||||
pub fn fit(&mut self, data: &Matrix) -> Model {
|
||||
let prob = data.to_problem();
|
||||
Model {
|
||||
model: unsafe { mf_train(&prob, self.param) },
|
||||
model: unsafe { mf_train(&prob, self.param) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ impl Params {
|
||||
let tr = train_set.to_problem();
|
||||
let va = eval_set.to_problem();
|
||||
Model {
|
||||
model: unsafe { mf_train_with_validation(&tr, &va, self.param) },
|
||||
model: unsafe { mf_train_with_validation(&tr, &va, self.param) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user