-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Giulia Baldini
committed
May 31, 2024
1 parent
8738672
commit b9babdd
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
|
||
import numpy as np | ||
from sklearn.utils._param_validation import InvalidParameterError | ||
|
||
from bico import BICO | ||
|
||
np.random.seed(42) | ||
|
||
|
||
class TestBICO(unittest.TestCase): | ||
|
||
example_data = np.random.rand(10000, 10) | ||
|
||
def test_fit(self) -> None: | ||
|
||
bico = BICO(n_clusters=2, random_state=42, fit_coreset=True) | ||
bico.fit(self.example_data) | ||
|
||
assert isinstance(bico.cluster_centers_, np.ndarray) | ||
|
||
def test_n_clusters(self) -> None: | ||
bico = BICO(n_clusters=0) | ||
|
||
self.assertRaises(InvalidParameterError, bico.fit, self.example_data) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |