fstar-compare 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ryan DeWolfe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: fstar-compare
3
+ Version: 0.0.3
4
+ Summary: A pragmatic method for comparing clusterings with ovalaps and outliers.
5
+ Author: Ryan DeWolfe
6
+ Author-email: Ryan DeWolfe <ryan.dewolfe@uwaterloo.ca>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Science/Research
13
+ Requires-Dist: numpy>=2.0
14
+ Requires-Dist: scipy>=1.10
15
+ Requires-Python: >=3.12
16
+ Project-URL: Homepage, https://github.com/ryandewolfe33/fstar
17
+ Project-URL: Repository, https://github.com/ryandewolfe33/fstar
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Fstar
21
+ A pragmatic method for comparing clusterings with overlaps and outliers.
22
+
23
+ ## Getting Started
24
+ The package is currently pip installable but is not on pypi. For now, please clone this
25
+ repository and install locally by following the instructions below.
26
+
27
+ ```{shell}
28
+ git clone https://github.com/ryandewolfe33/fstar.git
29
+ cd fstar
30
+ pip install .
31
+ ```
32
+
33
+ ## Example
34
+ For examples of using fstar, please see the notebooks in the `experiments` folder.
35
+
36
+ ## API
37
+ The main function is also named `fstar`, and computes a similarity score between two clusterings.
38
+ ```python
39
+ def fstar.fstar(
40
+ c1: sp.sparray | np.ndarray,
41
+ c2: sp.sparray | np.ndarray,
42
+ outliers: bool = True,
43
+ drop_outliers: bool | str =False,
44
+ alpha: float = 0.5
45
+ ) -> float:
46
+ """ Compute F*_wo between c1 and c2.
47
+
48
+ Parameters
49
+ ----------
50
+ c1:scipy.sparse.array or np.ndarray - the first clustering
51
+ c2:scipy.sparse_array or np.ndarray - the second clustering
52
+ outliers:bool (defualt=True) - Flag to add outlier comparison term. If True compute F*_wo,
53
+ if False compute F*_w
54
+ drop_outliers:[False, 'c1', 'c2', 'either', 'both'] (default=False) - Flag to drop objects
55
+ that consider outliers before computing score. Can be helpful for determining the quality
56
+ of the clusters when extra outliers are not a concern.
57
+ alpha:float (default=0.5) - A value between 0 and 1 to control the importance of matching
58
+ in each direction. The default 0.5 is a symmetric measure, alpha=1 puts all the weight on
59
+ the ability of each cluster in c1 to find a match and alpha=0 puts all the weight on the
60
+ ability of each cluster in c2 to find a match.
61
+
62
+ Returns
63
+ -------
64
+ float: the similarity scoree between c1 and c2.
65
+ """
66
+ ```
67
+ The clusterings may be input as either a sparse cluster x object membership matrix (entry (i,j)
68
+ is true if object j is in cluster i), or a 1d numpy where the value at index i is the cluster id
69
+ of object i (and -1 denotes no cluster, i.e, object i is an outlier).
70
+
71
+ If you want the cluster level fstar scores, or the ids of the best matching cluster, these
72
+ intermediate results are exposed as part of the `find_matches` function.
73
+ ```python
74
+ def find_best_matches(c1, c2, return_match_ids=False):
75
+ """ Find the best match for each cluster. Returns either
76
+ two arrays of the F* scores for each cluster, or if
77
+ `return_match_ids=True` then return four arrays, the first
78
+ two the same as above and the second two are the cluster ids
79
+ of the best match in the other clustering.
80
+
81
+ Parameters
82
+ ----------
83
+ c1: scipy.sparse_array - the first clustering
84
+ c2: scipy.sparse_array - the second clustering
85
+ return_match_ids:bool (default=False) - Flag to include match ids in return
86
+ """
87
+ ```
88
+
89
+ There are also two helper function for working with graph aware comparisons. To compute the closed
90
+ edge clustering of an edge clustering `e1`, run
91
+ `node_clustering_to_edge_clustering(adjacency, edge_clustering_to_node_clustering(adjacency, e1))`.
92
+ ```python
93
+ def fstar.node_clustering_to_edge_clustering(adjacency, node_clustering):
94
+ """ Project a node clustering onto the edges. An edge is in a cluster if both endpoints are in
95
+ that cluster. Edge ids are computed by the data_index of a csr representation of the upper
96
+ triangular adjacency matrix.
97
+
98
+ Parameters
99
+ ----------
100
+ adjacency:scipy.sparse.array - the adjacency matrix of the graph.
101
+ node_clustering:scipy.sparse_array or np.ndarray - the node clustering.
102
+
103
+ Returns
104
+ -------
105
+ scipy.sparse.csr_array - the induced edge clustering. Edge ids are the data_index of a csr
106
+ representation of the upper triangular adjacency matrix.
107
+ """
108
+ ```
109
+ ```python
110
+ def fstar.edge_clustering_to_node_clustering(adjacency, edge_clustering):
111
+ """
112
+ Project an edge clustering onto the nodes. An node is in a cluster if it has at least one
113
+ incident edge in that cluster. Edge ids are assumed to be the data_index of a csr
114
+ representation of the upper triangular adjacency matrix.
115
+
116
+ Parameters
117
+ ----------
118
+ adjacency:scipy.sparse.array - the adjacency matrix of the graph.
119
+ node_clustering:scipy.sparse_array or np.ndarray - the edge clustering. Edge ids are assumed
120
+ to be the data_index of a csr representation of the upper triangular adjacency matrix.
121
+
122
+ Returns
123
+ -------
124
+ scipy.sparse.csr_array - the induced node clustering.
125
+ """
126
+ ```
127
+
128
+
129
+ ## Reference
130
+ Ryan DeWolfe, Paweł Prałat, and François Théberge. A Pragmatic Method for Comparing Clusterings with
131
+ Overlaps and Outliers. arxiv preprint (2026).
132
+ [https://doi.org/10.48550/arXiv.2602.14855]([https://doi.org/10.48550/arXiv.2602.14855)
133
+
134
+ ```bibtex
135
+ @article{dewolfe2026fstar,
136
+ author = {Ryan DeWolfe and Paweł Prałat and François Théberge},
137
+ title = {A Pragmatic Method for Comparing Clusterings with Overlaps and Outliers},
138
+ journal = {arxiv preprint},
139
+ year = {2026},
140
+ doi = {10.48550/arXiv.2602.14855}
141
+ }
142
+ ```
@@ -0,0 +1,123 @@
1
+ # Fstar
2
+ A pragmatic method for comparing clusterings with overlaps and outliers.
3
+
4
+ ## Getting Started
5
+ The package is currently pip installable but is not on pypi. For now, please clone this
6
+ repository and install locally by following the instructions below.
7
+
8
+ ```{shell}
9
+ git clone https://github.com/ryandewolfe33/fstar.git
10
+ cd fstar
11
+ pip install .
12
+ ```
13
+
14
+ ## Example
15
+ For examples of using fstar, please see the notebooks in the `experiments` folder.
16
+
17
+ ## API
18
+ The main function is also named `fstar`, and computes a similarity score between two clusterings.
19
+ ```python
20
+ def fstar.fstar(
21
+ c1: sp.sparray | np.ndarray,
22
+ c2: sp.sparray | np.ndarray,
23
+ outliers: bool = True,
24
+ drop_outliers: bool | str =False,
25
+ alpha: float = 0.5
26
+ ) -> float:
27
+ """ Compute F*_wo between c1 and c2.
28
+
29
+ Parameters
30
+ ----------
31
+ c1:scipy.sparse.array or np.ndarray - the first clustering
32
+ c2:scipy.sparse_array or np.ndarray - the second clustering
33
+ outliers:bool (defualt=True) - Flag to add outlier comparison term. If True compute F*_wo,
34
+ if False compute F*_w
35
+ drop_outliers:[False, 'c1', 'c2', 'either', 'both'] (default=False) - Flag to drop objects
36
+ that consider outliers before computing score. Can be helpful for determining the quality
37
+ of the clusters when extra outliers are not a concern.
38
+ alpha:float (default=0.5) - A value between 0 and 1 to control the importance of matching
39
+ in each direction. The default 0.5 is a symmetric measure, alpha=1 puts all the weight on
40
+ the ability of each cluster in c1 to find a match and alpha=0 puts all the weight on the
41
+ ability of each cluster in c2 to find a match.
42
+
43
+ Returns
44
+ -------
45
+ float: the similarity scoree between c1 and c2.
46
+ """
47
+ ```
48
+ The clusterings may be input as either a sparse cluster x object membership matrix (entry (i,j)
49
+ is true if object j is in cluster i), or a 1d numpy where the value at index i is the cluster id
50
+ of object i (and -1 denotes no cluster, i.e, object i is an outlier).
51
+
52
+ If you want the cluster level fstar scores, or the ids of the best matching cluster, these
53
+ intermediate results are exposed as part of the `find_matches` function.
54
+ ```python
55
+ def find_best_matches(c1, c2, return_match_ids=False):
56
+ """ Find the best match for each cluster. Returns either
57
+ two arrays of the F* scores for each cluster, or if
58
+ `return_match_ids=True` then return four arrays, the first
59
+ two the same as above and the second two are the cluster ids
60
+ of the best match in the other clustering.
61
+
62
+ Parameters
63
+ ----------
64
+ c1: scipy.sparse_array - the first clustering
65
+ c2: scipy.sparse_array - the second clustering
66
+ return_match_ids:bool (default=False) - Flag to include match ids in return
67
+ """
68
+ ```
69
+
70
+ There are also two helper function for working with graph aware comparisons. To compute the closed
71
+ edge clustering of an edge clustering `e1`, run
72
+ `node_clustering_to_edge_clustering(adjacency, edge_clustering_to_node_clustering(adjacency, e1))`.
73
+ ```python
74
+ def fstar.node_clustering_to_edge_clustering(adjacency, node_clustering):
75
+ """ Project a node clustering onto the edges. An edge is in a cluster if both endpoints are in
76
+ that cluster. Edge ids are computed by the data_index of a csr representation of the upper
77
+ triangular adjacency matrix.
78
+
79
+ Parameters
80
+ ----------
81
+ adjacency:scipy.sparse.array - the adjacency matrix of the graph.
82
+ node_clustering:scipy.sparse_array or np.ndarray - the node clustering.
83
+
84
+ Returns
85
+ -------
86
+ scipy.sparse.csr_array - the induced edge clustering. Edge ids are the data_index of a csr
87
+ representation of the upper triangular adjacency matrix.
88
+ """
89
+ ```
90
+ ```python
91
+ def fstar.edge_clustering_to_node_clustering(adjacency, edge_clustering):
92
+ """
93
+ Project an edge clustering onto the nodes. An node is in a cluster if it has at least one
94
+ incident edge in that cluster. Edge ids are assumed to be the data_index of a csr
95
+ representation of the upper triangular adjacency matrix.
96
+
97
+ Parameters
98
+ ----------
99
+ adjacency:scipy.sparse.array - the adjacency matrix of the graph.
100
+ node_clustering:scipy.sparse_array or np.ndarray - the edge clustering. Edge ids are assumed
101
+ to be the data_index of a csr representation of the upper triangular adjacency matrix.
102
+
103
+ Returns
104
+ -------
105
+ scipy.sparse.csr_array - the induced node clustering.
106
+ """
107
+ ```
108
+
109
+
110
+ ## Reference
111
+ Ryan DeWolfe, Paweł Prałat, and François Théberge. A Pragmatic Method for Comparing Clusterings with
112
+ Overlaps and Outliers. arxiv preprint (2026).
113
+ [https://doi.org/10.48550/arXiv.2602.14855]([https://doi.org/10.48550/arXiv.2602.14855)
114
+
115
+ ```bibtex
116
+ @article{dewolfe2026fstar,
117
+ author = {Ryan DeWolfe and Paweł Prałat and François Théberge},
118
+ title = {A Pragmatic Method for Comparing Clusterings with Overlaps and Outliers},
119
+ journal = {arxiv preprint},
120
+ year = {2026},
121
+ doi = {10.48550/arXiv.2602.14855}
122
+ }
123
+ ```
@@ -0,0 +1 @@
1
+ from .fstar_ import *
@@ -0,0 +1,206 @@
1
+ import numpy as np
2
+ import scipy.sparse as sp
3
+
4
+
5
+ def clustering_array_to_sparse(clustering):
6
+ """Convert a numpy clsutering array to a (clusters x objects) csr array
7
+ Clusters are assumed to be contiguous 0-max(clustering), and -1 denotes objects with no clusters
8
+ """
9
+ object_ids = np.arange(len(clustering), dtype=clustering.dtype)
10
+ inliers = clustering >= 0
11
+ object_ids = object_ids[inliers]
12
+ cluster_ids = clustering[inliers]
13
+ data = np.ones_like(cluster_ids, dtype="bool")
14
+
15
+ clustering = sp.coo_array(
16
+ (data, (cluster_ids, object_ids))
17
+ )
18
+ clustering = clustering.tocsr()
19
+ return clustering
20
+
21
+
22
+ def node_clustering_to_edge_clustering(adjacency, node_clustering):
23
+ """
24
+ Project a node clustering onto the edges. An edge is in a cluster if both endpoints are in that cluster.
25
+ Edge ids are computed by the data_index of a csr representation of the upper triangular adjacency matrix.
26
+ """
27
+ if sp.issparse(adjacency):
28
+ adjacency = sp.triu(adjacency).tocsr()
29
+ else:
30
+ raise ValueError("adjacency must be a scipy.sparse array.")
31
+ if isinstance(node_clustering, np.ndarray):
32
+ node_clustering = clustering_array_to_sparse(node_clustering)
33
+ elif not sp.issparse(node_clustering):
34
+ raise ValueError("node_clustering must be a scipy.sparse array or a 1d numpy array.")
35
+
36
+ # Need fast access to clusters per node
37
+ node_clustering = node_clustering.tocsc()
38
+ edge_clustering = sp.lil_array((len(adjacency.indices), node_clustering.shape[0]), dtype="bool")
39
+ edge_id = 0
40
+ for n1 in range(len(adjacency.indptr)-1):
41
+ for n2 in adjacency.indices[adjacency.indptr[n1]:adjacency.indptr[n1+1]]:
42
+ common_clusters = np.intersect1d(
43
+ node_clustering.indices[node_clustering.indptr[n1]:node_clustering.indptr[n1+1]],
44
+ node_clustering.indices[node_clustering.indptr[n2]:node_clustering.indptr[n2+1]]
45
+ )
46
+ edge_clustering[edge_id, common_clusters] = True
47
+ edge_id += 1
48
+ return edge_clustering.tocsc().transpose()
49
+
50
+
51
+ def edge_clustering_to_node_clustering(adjacency, edge_clustering):
52
+ """
53
+ Project an edge clustering onto the nodes. An node is in a cluster if it has at least one incident edge in that cluster.
54
+ Edge ids are assumed to be the data_index of a csr representation of the upper triangular adjacency matrix.
55
+ """
56
+ if sp.issparse(adjacency):
57
+ adjacency = sp.triu(adjacency).tocsr()
58
+ else:
59
+ raise ValueError("adjacency must be a scipy.sparse array.")
60
+ if sp.issparse(edge_clustering):
61
+ edge_clustering = edge_clustering.tocsc()
62
+ elif isinstance(edge_clustering, np.ndarray):
63
+ edge_clustering = clustering_array_to_sparse(edge_clustering)
64
+ else:
65
+ raise ValueError("node_clustering must be a scipy.sparse array or a 1d numpy array.")
66
+
67
+ edge_clustering = edge_clustering.transpose().tocsr()
68
+ node_clustering = sp.dok_array((edge_clustering.shape[1], adjacency.shape[0]), dtype="bool")
69
+ edge_id = 0
70
+ for n1 in range(len(adjacency.indptr)-1):
71
+ for n2 in adjacency.indices[adjacency.indptr[n1]:adjacency.indptr[n1+1]]:
72
+ edge_clusters = edge_clustering.indices[edge_clustering.indptr[edge_id]:edge_clustering.indptr[edge_id+1]]
73
+ for cluster in edge_clusters:
74
+ node_clustering[cluster, n1] = True
75
+ node_clustering[cluster, n2] = True
76
+ edge_id += 1
77
+ return node_clustering.tocsr()
78
+
79
+
80
+ def find_best_matches(c1, c2, return_match_ids=False):
81
+ """ Find the best match for each cluster. Returns either
82
+ two arrays of the F* scores for each cluster, or if
83
+ `return_match_ids=True` then return four arrays, the first
84
+ two the same as above and the second two are the cluster ids
85
+ of the best match in the other clustering.
86
+
87
+ Parameters
88
+ ----------
89
+ c1: scipy.sparse_array - the first clustering
90
+ c2: scipy.sparse_array - the second clustering
91
+ return_match_ids:bool (default=False) - Flag to include match ids in return
92
+ """
93
+ c1 = c1.tocsr()
94
+ c2 = c2.tocsr()
95
+ intersect = c1.astype("float64") @ c2.transpose().astype("float64")
96
+ rs = np.asarray(c1.sum(axis=1)).reshape(-1) # row sums
97
+ cs = np.asarray(c2.sum(axis=1)).reshape(-1) # col sums
98
+ rd = sp.diags(rs, dtype="float64")
99
+ cd = sp.diags(cs, dtype="float64")
100
+ nz = intersect.copy() # Store non-zero data indices
101
+ nz.data = np.ones_like(nz.data)
102
+ union = rd @ nz + nz @ cd - intersect # union is |p| + |l| - |p and l|
103
+ union.data = 1/union.data
104
+ fs = intersect.multiply(union)
105
+
106
+ c1_fs = fs.max(axis=1).toarray().reshape(-1)
107
+ c2_fs = fs.max(axis=0).toarray().reshape(-1)
108
+
109
+ if return_match_ids:
110
+ c1_matches = fs.argmax(axis=1).toarray().reshape(-1)
111
+ c2_matches = fs.argmax(axis=0).toarray().reshape(-1)
112
+ return c1_fs, c2_fs, c1_matches, c2_matches
113
+
114
+ return c1_fs, c2_fs
115
+
116
+
117
+ def fstar(
118
+ c1: sp.sparray | np.ndarray,
119
+ c2: sp.sparray | np.ndarray,
120
+ outliers: bool = True,
121
+ drop_outliers: bool | str =False,
122
+ alpha: float = 0.5
123
+ ) -> float:
124
+ """ Compute F*_wo between c1 and c2.
125
+
126
+ Parameters
127
+ ----------
128
+ c1:scipy.sparse.array or np.ndarray - the first clustering
129
+ c2:scipy.sparse_array or np.ndarray - the second clustering
130
+ outliers:bool (defualt=True) - Flag to add outlier comparison term. If True compute F*_wo, if
131
+ False compute F*_w
132
+ drop_outliers:[False, 'c1', 'c2', 'either', 'both'] (default=False) - Flag to drop objects that
133
+ are consider outliers before computing score. Can be helpful for determining the quality of
134
+ the clusters when extra outliers are not a concern.
135
+ alpha:float (default=0.5) - A value between 0 and 1 to control the importance of matching in each
136
+ direction. The default 0.5 is a symmetric measure, alpha=1 puts all the weight on the ability
137
+ of each cluster in c1 to find a match and alpha=0 puts all the weight on the ability of each
138
+ cluster in c2 to find a match.
139
+
140
+ Returns
141
+ -------
142
+ float: the similarity scoree between c1 and c2.
143
+ """
144
+ if isinstance(c1, np.ndarray):
145
+ c1 = clustering_array_to_sparse(c1)
146
+ elif not sp.issparse(c1):
147
+ raise ValueError("Fstar expects a scipy.sparse array or a 1d numpy array.")
148
+ if isinstance(c2, np.ndarray):
149
+ c2 = clustering_array_to_sparse(c2)
150
+ elif not sp.issparse(c2):
151
+ raise ValueError("Fstar expects a scipy.sparse array or a 1d numpy array.")
152
+
153
+ #Finding and dropping outliers is easier in csc
154
+ c1 = c1.tocsc()
155
+ c2 = c2.tocsc()
156
+
157
+ if drop_outliers:
158
+ c1_outliers = (c1.indptr[1:] - c1.indptr[:-1]) == 0
159
+ c2_outliers = (c2.indptr[1:] - c2.indptr[:-1]) == 0
160
+ if drop_outliers == "c1":
161
+ drop = c1_outliers
162
+ elif drop_outliers == "c2":
163
+ drop = c2_outliers
164
+ elif drop_outliers == "either":
165
+ drop = np.bitwise_or(c1_outliers, c2_outliers)
166
+ elif drop_outliers == "both":
167
+ drop = np.bitwise_and(c1_outliers, c2_outliers)
168
+ else:
169
+ raise ValueError("drop_outliers must be Falsey or one of ['c1', 'c2', 'either', 'both'].")
170
+ c1 = c1[:, ~drop]
171
+ c2 = c2[:, ~drop]
172
+
173
+ # Neither have clusters
174
+ if c1.shape[0] == 0 and c2.shape[0] == 0:
175
+ return 1
176
+
177
+ c1_outliers = (c1.indptr[1:] - c1.indptr[:-1]) == 0
178
+ c2_outliers = (c2.indptr[1:] - c2.indptr[:-1]) == 0
179
+ outlier_intersect = np.sum(c1_outliers * c2_outliers)
180
+ outlier_fs = 0
181
+ if outlier_intersect > 0:
182
+ outlier_fs = outlier_intersect / (np.sum(c1_outliers) + np.sum(c2_outliers) - outlier_intersect)
183
+
184
+ c1_outlier_prop = np.sum(c1_outliers) / len(c1_outliers)
185
+ c2_outlier_prop = np.sum(c2_outliers) / len(c2_outliers)
186
+
187
+ # Only one has clusters
188
+ if c1.shape[0] == 0 or c2.shape[0] == 0:
189
+ if not outliers:
190
+ return 0
191
+ return outlier_fs * (alpha * c1_outlier_prop + (1-alpha) * c2_outlier_prop)
192
+
193
+ c1_fs, c2_fs = find_best_matches(c1, c2)
194
+
195
+ c1_props = np.asarray(c1.sum(axis=1)).reshape(-1)
196
+ c1_props = c1_props / np.sum(c1_props)
197
+ c1_fsw = np.sum(c1_fs * c1_props)
198
+ c2_props = np.asarray(c2.sum(axis=1)).reshape(-1)
199
+ c2_props = c2_props / np.sum(c2_props)
200
+ c2_fsw = np.sum(c2_fs * c2_props)
201
+
202
+ if outliers:
203
+ c1_fsw = c1_outlier_prop * outlier_fs + (1-c1_outlier_prop) * c1_fsw
204
+ c2_fsw = c2_outlier_prop * outlier_fs + (1-c2_outlier_prop) * c2_fsw
205
+
206
+ return alpha * c1_fsw + (1-alpha) * c2_fsw
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.12.20,<0.13"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "fstar-compare"
7
+ version = "0.0.3"
8
+ description = "A pragmatic method for comparing clusterings with ovalaps and outliers."
9
+ classifiers = [
10
+ "Development Status :: 4 - Beta",
11
+ "Programming Language :: Python",
12
+ "Operating System :: OS Independent",
13
+ "Intended Audience :: Science/Research",
14
+ ]
15
+ readme = "README.md"
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
18
+ requires-python = ">=3.12"
19
+ dependencies = [
20
+ "numpy >= 2.0",
21
+ "scipy >= 1.10",
22
+ ]
23
+
24
+ [[project.authors]]
25
+ name = "Ryan DeWolfe"
26
+ email = "ryan.dewolfe@uwaterloo.ca"
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/ryandewolfe33/fstar"
30
+ Repository = "https://github.com/ryandewolfe33/fstar"
31
+
32
+ [dependency-groups]
33
+ dev = [
34
+ "pytest>=9.1.1",
35
+ "ruff>=0.17.1",
36
+ ]
37
+ experiments = [
38
+ "abcd-graph",
39
+ "clusim>=0.4",
40
+ "egosplit-sknetwork>=0.0.4",
41
+ "ipykernel>=7.4.0",
42
+ "matplotlib>=3.11.2",
43
+ "scikit-network>=0.33.5",
44
+ "tqdm>=4.70.1",
45
+ ]
46
+
47
+ [tool.uv.build-backend]
48
+ module-name = "fstar"
49
+ module-root = ""
50
+
51
+ [tool.uv.sources.clusim]
52
+ git = "https://github.com/Hoosier-Clusters/clusim"
53
+
54
+ [tool.uv.sources.abcd-graph]
55
+ git = "https://github.com/ryandewolfe33/abcd-graph"
56
+ branch = "release/0.5.0-beta"
57
+
58
+ [tool.ruff]
59
+ line-length = 88
60
+ target-version = "py314"
61
+ exclude = [
62
+ ".git",
63
+ "build",
64
+ "dist",
65
+ ]
66
+
67
+ [tool.ruff.lint]
68
+ select = [
69
+ "E",
70
+ "W",
71
+ "F",
72
+ "I",
73
+ "B",
74
+ "C4",
75
+ "SIM",
76
+ "UP",
77
+ ]
78
+ ignore = [
79
+ "E501",
80
+ "B905",
81
+ ]
82
+
83
+ [tool.ruff.lint.per-file-ignores]
84
+ "__init__.py" = [
85
+ "F401",
86
+ "F403",
87
+ ]
@@ -0,0 +1,79 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.12.20,<0.13"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "fstar-compare"
7
+ version = "0.0.3"
8
+ authors = [{ name="Ryan DeWolfe", email="ryan.dewolfe@uwaterloo.ca" }]
9
+ description = "A pragmatic method for comparing clusterings with ovalaps and outliers."
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Programming Language :: Python",
13
+ "Operating System :: OS Independent",
14
+ "Intended Audience :: Science/Research",
15
+ ]
16
+ readme = "README.md"
17
+ license = "MIT"
18
+ license-files = ["LICENSE"]
19
+
20
+ requires-python = ">=3.12"
21
+ dependencies = [
22
+ "numpy >= 2.0",
23
+ "scipy >= 1.10",
24
+ ]
25
+
26
+ [dependency-groups]
27
+ dev = [
28
+ "pytest>=9.1.1",
29
+ "ruff>=0.17.1",
30
+ ]
31
+ experiments = [
32
+ "abcd-graph",
33
+ "clusim>=0.4",
34
+ "egosplit-sknetwork>=0.0.4",
35
+ "ipykernel>=7.4.0",
36
+ "matplotlib>=3.11.2",
37
+ "scikit-network>=0.33.5",
38
+ "tqdm>=4.70.1",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/ryandewolfe33/fstar"
43
+ Repository = "https://github.com/ryandewolfe33/fstar"
44
+
45
+ [tool.uv.build-backend]
46
+ module-name = "fstar"
47
+ module-root = ""
48
+
49
+ [tool.uv.sources]
50
+ clusim = { git = "https://github.com/Hoosier-Clusters/clusim" }
51
+ abcd-graph = { git = "https://github.com/ryandewolfe33/abcd-graph", branch = "release/0.5.0-beta" }
52
+
53
+ [tool.ruff]
54
+ line-length = 88
55
+ target-version = "py314"
56
+ exclude = [
57
+ ".git",
58
+ "build",
59
+ "dist",
60
+ ]
61
+
62
+ [tool.ruff.lint]
63
+ select = [
64
+ "E", # pycodestyle errors
65
+ "W", # pycodestyle warnings
66
+ "F", # pyflakes
67
+ "I", # isort
68
+ "B", # flake8-bugbear
69
+ "C4", # flake8-comprehensions
70
+ "SIM", # flake8-simplify (helps write simpler code)
71
+ "UP", # pyupgrade
72
+ ]
73
+ ignore = [
74
+ "E501", # line too long (handled by formatter)
75
+ "B905", # Do not require strict in zip, not compatible with numba
76
+ ]
77
+
78
+ [tool.ruff.lint.per-file-ignores]
79
+ "__init__.py" = ["F401", "F403"]