make build_param public
Some checks failed
build / build (ubuntu-latest) (push) Failing after 36s
build / build (windows-latest) (push) Has been cancelled

This commit is contained in:
2025-02-26 21:23:31 +00:00
parent 4422684acc
commit b9cd23fe01
3 changed files with 8 additions and 7 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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