Skip to content

Commit

Permalink
fix(py): n_cluter & max_iter can be 1
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy committed Dec 6, 2024
1 parent c599799 commit 1b15e46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/kmeans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ impl KMeans {
distance: Distance,
use_residual: bool,
) -> Self {
if n_cluster <= 1 {
panic!("n_cluster must be greater than 1");
if n_cluster < 1 {
panic!("n_cluster must be greater than 0");
}
if max_iter <= 1 {
panic!("max_iter must be greater than 1");
if max_iter < 1 {
panic!("max_iter must be greater than 0");
}
if tolerance <= 0.0 {
panic!("tolerance must be greater than 0.0");
Expand Down

0 comments on commit 1b15e46

Please sign in to comment.