make build_param public
This commit is contained in:
@@ -8,6 +8,7 @@ mod model;
|
||||
mod params;
|
||||
|
||||
pub use bindings::Loss;
|
||||
pub use bindings::*;
|
||||
pub use error::Error;
|
||||
pub use matrix::Matrix;
|
||||
pub use model::Model;
|
||||
|
||||
@@ -29,7 +29,7 @@ impl Matrix {
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn to_problem(&self) -> MfProblem {
|
||||
pub fn to_problem(&self) -> MfProblem {
|
||||
let data = &self.data;
|
||||
let m = data.iter().map(|x| x.u).max().unwrap_or(-1) + 1;
|
||||
let n = data.iter().map(|x| x.v).max().unwrap_or(-1) + 1;
|
||||
|
||||
@@ -133,7 +133,7 @@ impl Params {
|
||||
}
|
||||
|
||||
// check parameters in Rust for better error message
|
||||
fn build_param(&self) -> Result<MfParameter, Error> {
|
||||
pub fn build_param(&self) -> Result<MfParameter, Error> {
|
||||
let param = self.param;
|
||||
|
||||
if param.k < 1 {
|
||||
@@ -154,11 +154,11 @@ impl Params {
|
||||
));
|
||||
}
|
||||
|
||||
if param.nr_iters < 1 {
|
||||
return Err(Error::Parameter(
|
||||
"number of iterations must be greater than zero".to_string(),
|
||||
));
|
||||
}
|
||||
// if param.nr_iters < 1 {
|
||||
// return Err(Error::Parameter(
|
||||
// "number of iterations must be greater than zero".to_string(),
|
||||
// ));
|
||||
// }
|
||||
|
||||
if param.lambda_p1 < 0.0
|
||||
|| param.lambda_p2 < 0.0
|
||||
|
||||
Reference in New Issue
Block a user