Skip to content

Commit

Permalink
Fix deprecated functions (as it should have been wired)
Browse files Browse the repository at this point in the history
  • Loading branch information
relf committed Jan 27, 2025
1 parent 5453590 commit 43b1829
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions algorithms/linfa-svm/src/hyperparams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,23 @@ impl<F: Float, T> SvmParams<F, T> {
}

impl<F: Float> SvmParams<F, F> {
/// Set the C value for regression
#[deprecated(since = "0.7.2", note = "Use c_svr() instead")]
/// Set the C value for regression and solver epsilon stopping condition.
/// Loss epsilon value is fixed at 0.1.
#[deprecated(since = "0.7.2", note = "Use .c_svr() and .eps()")]
pub fn c_eps(mut self, c: F, eps: F) -> Self {
self.0.c = Some((c, eps));
self.0.c = Some((c, F::cast(0.1)));
self.0.nu = None;
self.0.solver_params.eps = eps;
self
}

/// Set the Nu-Eps value for regression
#[deprecated(since = "0.7.2", note = "Use nu_svr() instead")]
/// Set the Nu value for regression and solver epsilon stopping condition.
/// C value used value is fixed at 1.0.
#[deprecated(since = "0.7.2", note = "Use .nu_svr() and .eps()")]
pub fn nu_eps(mut self, nu: F, eps: F) -> Self {
self.0.nu = Some((nu, eps));
self.0.nu = Some((nu, F::one()));
self.0.c = None;
self.0.solver_params.eps = eps;
self
}

Expand Down
2 changes: 2 additions & 0 deletions algorithms/linfa-svm/src/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ pub mod tests {
let model = Svm::params()
.c_svr(100., Some(0.1))
.gaussian_kernel(10.)
.eps(1e-3)
.fit(&dataset)?;

println!("{}", model);
Expand All @@ -287,6 +288,7 @@ pub mod tests {
let model = Svm::params()
.nu_svr(0.01, None)
.polynomial_kernel(1., 3.)
.eps(1e-3)
.fit(&dataset)?;

println!("{}", model);
Expand Down

0 comments on commit 43b1829

Please sign in to comment.