Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
43cf464
Add initial ivf index implementation
IgnacioJPickering Oct 28, 2025
ee10a01
Delete old ivf index file
IgnacioJPickering Oct 30, 2025
73656b6
Add ivf impl
IgnacioJPickering Oct 30, 2025
b39118a
Initial IVF implementation, library API and CLI
IgnacioJPickering Oct 30, 2025
23e0924
Fix mypy
IgnacioJPickering Oct 30, 2025
9a9a3b1
Change names
IgnacioJPickering Oct 30, 2025
0baeb59
Add comment
IgnacioJPickering Oct 30, 2025
adc5d5c
Save IVF index and add --global flag to all methods
IgnacioJPickering Oct 30, 2025
dbdf88b
Build ivf index from dir
IgnacioJPickering Oct 30, 2025
7e4b828
Add flag to plotting
IgnacioJPickering Oct 30, 2025
63e0ca8
Rename _ivf -> ivf
IgnacioJPickering Oct 30, 2025
11c0304
Black
IgnacioJPickering Oct 30, 2025
3882aae
Omit smiles
IgnacioJPickering Oct 30, 2025
e1595e5
Add option to build idx after running bblean
IgnacioJPickering Oct 30, 2025
b765b52
Omit all smiles files
IgnacioJPickering Oct 30, 2025
4dfaeb2
Modify smiles file name
IgnacioJPickering Oct 30, 2025
4bdc409
Update warning
IgnacioJPickering Nov 2, 2025
51f2a94
Add IVF to multiround
IgnacioJPickering Nov 2, 2025
7663ac3
Merge branch 'main' into feature/ipickering/bb-ivf
IgnacioJPickering Nov 5, 2025
5512881
Merge branch 'main' into feature/ipickering/bb-ivf
IgnacioJPickering Nov 12, 2025
4752e9f
Merge branch 'main' into feature/ipickering/bb-ivf
IgnacioJPickering Nov 18, 2025
5702a8d
Merge branch 'main' into feature/ipickering/bb-ivf
IgnacioJPickering Dec 11, 2025
a48801d
Merge branch 'main' into feature/ipickering/bb-ivf
IgnacioJPickering Feb 23, 2026
43e7628
Update similarity
IgnacioJPickering Feb 23, 2026
0968cf7
Add option for morgan fps in the query
IgnacioJPickering Feb 23, 2026
ae6b806
Implement direct reassignment
IgnacioJPickering Feb 23, 2026
527a465
Fix predictor
IgnacioJPickering Feb 23, 2026
575855c
Fix reassignment
IgnacioJPickering Feb 23, 2026
c1e3312
Fix input smiles dir
IgnacioJPickering Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ cluster-mol-ids*.json
config*.json
timings*.json
max-rss.txt
*.smi
!chembl-33-natural-products-subset.smi

# Pickle
*.pkl
Expand Down
15 changes: 7 additions & 8 deletions bblean/bitbirch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,9 +1482,12 @@ def global_clustering(
if not self.is_init:
raise ValueError("The model has not been fitted yet.")
centroids = np.vstack(self.get_centroids(packed=False))
labels = self._centrals_global_clustering(
predictor = self._global_clustering_predictor(
centroids, n_clusters, method=method, input_is_packed=False, **method_kwargs
)
# Add 1 to start labels from 1 instead of 0, so 0 can be used as sentinel
# value
labels = predictor.fit_predict(centroids) + 1
num_centroids = len(centroids)
self._n_global_clusters = (
n_clusters if num_centroids > n_clusters else num_centroids
Expand All @@ -1493,7 +1496,7 @@ def global_clustering(
return self

@staticmethod
def _centrals_global_clustering(
def _global_clustering_predictor(
centrals: NDArray[np.uint8],
n_clusters: int,
*,
Expand All @@ -1502,7 +1505,7 @@ def _centrals_global_clustering(
n_features: int | None = None,
# TODO: Type correctly
**method_kwargs: tp.Any,
) -> NDArray[np.int64]:
) -> tp.Any:
r""":meta private:"""
if method not in {"agglomerative", "kmeans", "kmeans-normalized"}:
raise ValueError(f"Unknown method {method}")
Expand Down Expand Up @@ -1532,11 +1535,7 @@ def _centrals_global_clustering(
else:
raise ValueError("method must be one of 'kmeans' or 'agglomerative'")

# Add 1 to start labels from 1 instead of 0, so 0 can be used as sentinel
# value
# This is the bottleneck for building this index
# K-means is feasible, agglomerative is extremely expensive
return predictor.fit_predict(centrals) + 1
return predictor


# There are 4 cases here:
Expand Down
Loading