Skip to content

Commit 94fc03c

Browse files
authored
Merge pull request #1009 from gchq/release/1.0.0
Release v1.0.0
2 parents d7c0652 + 2530569 commit 94fc03c

File tree

7 files changed

+55
-195
lines changed

7 files changed

+55
-195
lines changed

CHANGELOG.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
-
13+
14+
### Fixed
15+
16+
-
17+
18+
### Changed
19+
20+
-
21+
22+
### Removed
23+
24+
-
25+
26+
### Deprecated
27+
28+
-
29+
30+
31+
## [1.0.0]
32+
33+
### Added
34+
35+
- Coreax is now considered stable. (https://github.com/gchq/coreax/pull/1009)
1236
- Added Compress++ coreset reduction algorithm.
1337
(https://github.com/gchq/coreax/issues/934)
1438
- Added `reduce_iterative()` method to Kernel Herding. (https://github.com/gchq/coreax/pull/983)
1539
- Added probabilistic iterative Kernel Herding benchmarking results. (https://github.com/gchq/coreax/pull/983)
1640
- Analytic example with integration test for `GreedyKernelPoints` plus an analytic unit
1741
test for the loss function. (https://github.com/gchq/coreax/pull/1004)
1842

19-
### Fixed
20-
21-
-
22-
2343
### Changed
2444

2545
- Changed the score function used by Stein Thinning in benchmarking.
@@ -35,10 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3555

3656
- `Coming soon` sections from README and documentation, as covered by backlogs.
3757
(https://github.com/gchq/coreax/pull/972)
38-
39-
### Deprecated
40-
41-
-
58+
- **[BREAKING CHANGE]** Removed deprecated Coreset functionality - see v0.4.0's
59+
deprecations for more detail. (https://github.com/gchq/coreax/pull/1009)
4260

4361

4462
## [0.4.0]
@@ -405,7 +423,8 @@ from `coreax.inverses.RegularisedInverseApproximator`,
405423
[//]: # (### Deprecated)
406424
[//]: # (This is where existing but deprecated elements should be noted.)
407425

408-
[Unreleased]: https://github.com/gchq/coreax/compare/v0.4.0...HEAD
426+
[Unreleased]: https://github.com/gchq/coreax/compare/v1.0.0...HEAD
427+
[1.0.0]: https://github.com/gchq/coreax/compare/v0.4.0...v1.0.0
409428
[0.4.0]: https://github.com/gchq/coreax/compare/v0.3.1...v0.4.0
410429
[0.3.1]: https://github.com/gchq/coreax/compare/v0.3.0...v0.3.1
411430
[0.3.0]: https://github.com/gchq/coreax/compare/v0.2.1...v0.3.0

CONTRIBUTING.md

+7-15
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,9 @@ Refs: #123
9191

9292
### Breaking changes and deprecation
9393

94-
Since we are still pre-1.0, [SemVer] states that any release may contain breaking
95-
changes. However, breaking changes should not be made without warning.
96-
97-
Any breaking changes must have a deprecation period of at least **one minor release,
98-
or one month (whichever is longer),** before the breaking change is made. If the change
99-
is one that may require significant changes to client code, such as removing a function
100-
or class entirely, the deprecation period must instead be at least **two minor releases,
101-
or two months (whichever is longer).**
94+
Coreax is stable, so according to [SemVer], any breaking changes require incrementing
95+
the major version number. Any change that would otherwise be breaking should instead be
96+
made into a deprecation if possible.
10297

10398
Ensure that during the deprecation period, the old behaviour still works, but raises a
10499
`DeprecationWarning` with an appropriate message (which should include which version
@@ -111,22 +106,19 @@ As an example, this is what the deprecation period for renaming `my_old_function
111106
`my_new_function` would look like:
112107

113108
```python
114-
# v0.1.0:
109+
# v1.1.0:
115110
def my_old_function(x: int) -> int:
116111
return x + x + x + x
117112

118-
# v0.2.0:
113+
# v1.2.0:
119114
def my_new_function(x: int) -> int:
120115
return x*4
121116

122-
@deprecated(
123-
"Renamed to my_new_function."
124-
+ " Deprecated since v0.2.0; will be removed in v0.3.0."
125-
)
117+
@deprecated("Renamed to my_new_function; will be removed in the next major version")
126118
def my_old_function(x: int) -> int:
127119
return my_new_function(x)
128120

129-
# v0.3.0:
121+
# v2.0.0:
130122
def my_new_function(x: int) -> int:
131123
return x*4
132124
```

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
1111
[![Python version](https://img.shields.io/pypi/pyversions/coreax.svg)](https://pypi.org/project/coreax)
1212
[![PyPI](https://img.shields.io/pypi/v/coreax)](https://pypi.org/project/coreax)
13-
![Beta](https://img.shields.io/badge/pre--release-beta-red)
1413

1514
_© Crown Copyright GCHQ_
1615

coreax/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
"""
2424

25-
__version__ = "0.4.0"
25+
__version__ = "1.0.0"
2626

2727
from coreax.approximation import (
2828
ANNchorApproximateKernel,

coreax/coreset.py

+15-119
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
"""Module for defining coreset data structures."""
1616

17-
import warnings
1817
from abc import abstractmethod
1918
from typing import (
2019
TYPE_CHECKING,
@@ -28,7 +27,7 @@
2827
import equinox as eqx
2928
import jax.numpy as jnp
3029
from jaxtyping import Array, Shaped
31-
from typing_extensions import Self, deprecated, override
30+
from typing_extensions import Self, override
3231

3332
from coreax.data import Data, SupervisedData, as_data
3433
from coreax.metrics import Metric
@@ -68,16 +67,6 @@ def points(self) -> _TPointsData_co:
6867
def pre_coreset_data(self) -> _TOriginalData_co:
6968
"""The original data that this coreset is based on."""
7069

71-
@property
72-
@abstractmethod
73-
@deprecated(
74-
"Narrow to a subclass, then use `.indices` or `.points` instead. "
75-
+ "Deprecated since v0.4.0. "
76-
+ "Will be removed in v0.5.0."
77-
)
78-
def nodes(self) -> Data:
79-
"""Deprecated alias for `indices` or `points`, depending on subclass."""
80-
8170
@abstractmethod
8271
def solve_weights(self, solver: WeightsOptimiser[Data], **solver_kwargs) -> Self:
8372
"""Return a copy of 'self' with weights solved by 'solver'."""
@@ -100,16 +89,6 @@ def __check_init__(self) -> None:
10089
"by definition of a Coreset"
10190
)
10291

103-
@property
104-
@deprecated(
105-
"Use `.points` instead. "
106-
+ "Deprecated since v0.4.0. "
107-
+ "Will be removed in v0.5.0."
108-
)
109-
def coreset(self) -> _TPointsData_co:
110-
"""Deprecated alias for `.points`."""
111-
return self.points
112-
11392

11493
class PseudoCoreset(
11594
AbstractCoreset[Data, _TOriginalData_co], Generic[_TOriginalData_co]
@@ -135,41 +114,15 @@ class PseudoCoreset(
135114

136115
def __init__(self, nodes: Data, pre_coreset_data: _TOriginalData_co) -> None:
137116
"""Initialise self."""
138-
if isinstance(nodes, Array):
139-
warnings.warn(
140-
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
141-
"Use PseudoCoreset.build() instead. "
142-
"In v0.5.0, this will become a TypeError.",
143-
DeprecationWarning,
144-
stacklevel=2,
145-
)
146-
nodes = as_data(nodes) # pyright: ignore[reportAssignmentType]
147-
if isinstance(pre_coreset_data, Array):
148-
warnings.warn(
149-
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
150-
"Use PseudoCoreset.build() instead. "
151-
"In v0.5.0, this will become a TypeError.",
152-
DeprecationWarning,
153-
stacklevel=2,
154-
)
155-
# pylint: disable-next=line-too-long
156-
pre_coreset_data = as_data(pre_coreset_data) # pyright: ignore[reportAssignmentType]
157-
if isinstance(pre_coreset_data, tuple):
158-
warnings.warn(
159-
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
160-
"Use PseudoCoreset.build() instead. "
161-
"In v0.5.0, this will become a TypeError.",
162-
DeprecationWarning,
163-
stacklevel=2,
164-
)
165-
# pylint: disable-next=line-too-long
166-
pre_coreset_data = SupervisedData(*pre_coreset_data) # pyright: ignore[reportAssignmentType]
167-
168117
if not isinstance(nodes, Data):
169-
raise TypeError("`nodes` must be of type `Data`")
118+
raise TypeError(
119+
"`nodes` must be of type `Data`. "
120+
"To use an array, use PseudoCoreset.build() instead."
121+
)
170122
if not isinstance(pre_coreset_data, Data):
171123
raise TypeError(
172-
"`pre_coreset_data` must be of type `Data` or `SupervisedData`"
124+
"`pre_coreset_data` must be of type `Data` or `SupervisedData`. "
125+
"To use an array or tuple of arrays, use PseudoCoreset.build() instead."
173126
)
174127

175128
self._nodes = nodes
@@ -238,40 +191,20 @@ def points(self) -> Data:
238191
def pre_coreset_data(self):
239192
return self._pre_coreset_data
240193

241-
@property
242-
@override
243-
@deprecated(
244-
"Use `.points` instead. "
245-
+ "Deprecated since v0.4.0. "
246-
+ "Will be removed in v0.5.0."
247-
)
248-
def nodes(self) -> Data:
249-
"""Deprecated alias for `points`."""
250-
return self.points
251-
252194
@override
253195
def solve_weights(self, solver: WeightsOptimiser[Data], **solver_kwargs) -> Self:
254196
"""Return a copy of 'self' with weights solved by 'solver'."""
255197
weights = solver.solve(self.pre_coreset_data, self.points, **solver_kwargs)
256198
return eqx.tree_at(lambda x: x.points.weights, self, weights)
257199

258200

259-
@deprecated(
260-
"Use AbstractCoreset, PseudoCoreset, or Coresubset instead. "
261-
+ "Deprecated since v0.4.0. "
262-
+ "Will be removed in v0.5.0."
263-
)
264-
class Coreset(PseudoCoreset):
265-
"""Deprecated - split into AbstractCoreset and PseudoCoreset."""
266-
267-
268201
class Coresubset(
269202
AbstractCoreset[_TOriginalData_co, _TOriginalData_co], Generic[_TOriginalData_co]
270203
):
271204
r"""
272205
Data structure for representing a coresubset.
273206
274-
A coresubset is a :class:`Coreset`, with the additional condition that the coreset
207+
A coresubset is a coreset, with the additional condition that the coreset
275208
data points/nodes must be a subset of the original data points/nodes, such that
276209
277210
.. math::
@@ -302,42 +235,16 @@ class Coresubset(
302235
# pylint: enable=invalid-name
303236

304237
def __init__(self, indices: Data, pre_coreset_data: _TOriginalData_co) -> None:
305-
"""Handle type conversion of ``indices`` and ``pre_coreset_data``."""
306-
if isinstance(indices, Array):
307-
warnings.warn(
308-
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
309-
"Use Coresubset.build() instead. "
310-
"In v0.5.0, this will become a TypeError.",
311-
DeprecationWarning,
312-
stacklevel=2,
313-
)
314-
indices = as_data(indices) # pyright: ignore[reportAssignmentType]
315-
if isinstance(pre_coreset_data, Array):
316-
warnings.warn(
317-
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
318-
"Use Coresubset.build() instead. "
319-
"In v0.5.0, this will become a TypeError.",
320-
DeprecationWarning,
321-
stacklevel=2,
322-
)
323-
# pylint: disable-next=line-too-long
324-
pre_coreset_data = as_data(pre_coreset_data) # pyright: ignore[reportAssignmentType]
325-
if isinstance(pre_coreset_data, tuple):
326-
warnings.warn(
327-
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
328-
"Use Coresubset.build() instead. "
329-
"In v0.5.0, this will become a TypeError.",
330-
DeprecationWarning,
331-
stacklevel=2,
332-
)
333-
# pylint: disable-next=line-too-long
334-
pre_coreset_data = SupervisedData(*pre_coreset_data) # pyright: ignore[reportAssignmentType]
335-
238+
"""Initialise self."""
336239
if not isinstance(indices, Data):
337-
raise TypeError("`indices` must be of type `Data`")
240+
raise TypeError(
241+
"`indices` must be of type `Data`. "
242+
"To use an array, use PseudoCoreset.build() instead."
243+
)
338244
if not isinstance(pre_coreset_data, Data):
339245
raise TypeError(
340-
"`pre_coreset_data` must be of type `Data` or `SupervisedData`"
246+
"`pre_coreset_data` must be of type `Data` or `SupervisedData`. "
247+
"To use an array or tuple of arrays, use PseudoCoreset.build() instead."
341248
)
342249

343250
self._indices = indices
@@ -416,17 +323,6 @@ def indices(self) -> Data:
416323
"""The (possibly weighted) Coresubset indices."""
417324
return self._indices
418325

419-
@property
420-
@override
421-
@deprecated(
422-
"Use `.indices` instead. "
423-
+ "Deprecated since v0.4.0. "
424-
+ "Will be removed in v0.5.0."
425-
)
426-
def nodes(self) -> Data:
427-
"""Deprecated alias for `indices`."""
428-
return self.indices
429-
430326
@override
431327
def solve_weights(self, solver: WeightsOptimiser[Data], **solver_kwargs) -> Self:
432328
"""Return a copy of 'self' with weights solved by 'solver'."""

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = [
1212
"coreset",
1313
]
1414
classifiers = [
15-
"Development Status :: 4 - Beta",
15+
"Development Status :: 5 - Production/Stable",
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3.9",
1818
"Programming Language :: Python :: 3.10",

0 commit comments

Comments
 (0)