Skip to content

Commit

Permalink
fix metacluster bug with test
Browse files Browse the repository at this point in the history
  • Loading branch information
berombau committed Nov 25, 2024
1 parent 05c602f commit 2c04f38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/flowsom/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def metacluster(self, n_clusters=None):
"""
if n_clusters is None:
n_clusters = self.n_clusters
self.model.set_n_clusters(n_clusters)
self.model.set_n_clusters(n_clusters)
self.model.metacluster_model.fit_predict(self.model.codes)
return self

Expand Down
7 changes: 7 additions & 0 deletions tests/models/test_FlowSOMModel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from sklearn.metrics import v_measure_score

from flowsom.main import FlowSOM
from flowsom.models import FlowSOMEstimator


Expand Down Expand Up @@ -33,3 +34,9 @@ def test_reproducibility_seed(X):
y_pred_2 = fsom_2.fit_predict(X)

assert all(y_pred_1 == y_pred_2)

def test_metacluster(X):
fsom = FlowSOM(X, n_clusters=10)
assert 10 == fsom.model.metacluster_model.n_clusters
fsom.metacluster(n_clusters=5)
assert 5 == fsom.model.metacluster_model.n_clusters

0 comments on commit 2c04f38

Please sign in to comment.