Skip to content

Commit dccbcf3

Browse files
hadifawaz1999TonyBagnallMatthewMiddlehurst
authored
[MNT] Remove python 3.12 constraint for deep learners (#2256)
* remove py312 constraint * add equal to py version * remove config from encoder * Update test_all_networks.py * Update base.py * Update _encoder.py * change to <3.13 * base init too to 3.13 --------- Co-authored-by: Tony Bagnall <[email protected]> Co-authored-by: Matthew Middlehurst <[email protected]>
1 parent 3d13d5b commit dccbcf3

18 files changed

+57
-41
lines changed

aeon/networks/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Deep learning networks."""
22

33
__all__ = [
4-
"BaseDeepNetwork",
54
"BaseDeepLearningNetwork",
65
"TimeCNNNetwork",
76
"EncoderNetwork",

aeon/networks/_ae_abgru.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Implements an Auto-Encoder based on Attention Bidirectional GRUs."""
22

3+
__maintainer__ = ["aadya940", "hadifawaz1999"]
4+
35
from aeon.networks.base import BaseDeepLearningNetwork
46

57

@@ -37,7 +39,7 @@ class AEAttentionBiGRUNetwork(BaseDeepLearningNetwork):
3739

3840
_config = {
3941
"python_dependencies": ["tensorflow"],
40-
"python_version": "<3.12",
42+
"python_version": "<3.13",
4143
"structure": "auto-encoder",
4244
}
4345

aeon/networks/_ae_bgru.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AEBiGRUNetwork(BaseDeepLearningNetwork):
2626

2727
_config = {
2828
"python_dependencies": ["tensorflow"],
29-
"python_version": "<3.12",
29+
"python_version": "<3.13",
3030
"structure": "auto-encoder",
3131
}
3232

aeon/networks/_ae_dcnn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Auto-Encoder based on Dilated Convolutional Nerual Networks (DCNN) Model."""
22

3-
__maintainer__ = []
3+
__maintainer__ = ["aadya940", "hadifawaz1999"]
44

55
import warnings
66

@@ -54,7 +54,7 @@ class AEDCNNNetwork(BaseDeepLearningNetwork):
5454

5555
_config = {
5656
"python_dependencies": ["tensorflow"],
57-
"python_version": "<3.12",
57+
"python_version": "<3.13",
5858
"structure": "auto-encoder",
5959
}
6060

aeon/networks/_ae_drnn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Auto-Encoder based Dilated Recurrent Neural Networks (DRNN)."""
22

3-
__maintainer__ = []
3+
__maintainer__ = ["aadya940", "hadifawaz1999"]
44

55
from aeon.networks.base import BaseDeepLearningNetwork
66
from aeon.utils.validation._dependencies import _check_soft_dependencies
@@ -58,7 +58,7 @@ class AEDRNNNetwork(BaseDeepLearningNetwork):
5858

5959
_config = {
6060
"python_dependencies": ["tensorflow"],
61-
"python_version": "<3.12",
61+
"python_version": "<3.13",
6262
"structure": "auto-encoder",
6363
}
6464

aeon/networks/_ae_fcn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AEFCNNetwork(BaseDeepLearningNetwork):
5858

5959
_config = {
6060
"python_dependencies": ["tensorflow"],
61-
"python_version": "<3.12",
61+
"python_version": "<3.13",
6262
"structure": "auto-encoder",
6363
}
6464

aeon/networks/_ae_resnet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AEResNetNetwork(BaseDeepLearningNetwork):
7070

7171
_config = {
7272
"python_dependencies": ["tensorflow"],
73-
"python_version": "<3.12",
73+
"python_version": "<3.13",
7474
"structure": "auto-encoder",
7575
}
7676

aeon/networks/_cnn.py

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ class TimeCNNNetwork(BaseDeepLearningNetwork):
5050
Journal of Systems Engineering and Electronics 28(1), 162--169, 2017
5151
"""
5252

53+
_config = {
54+
"python_dependencies": ["tensorflow"],
55+
"python_version": "<3.13",
56+
"structure": "encoder",
57+
}
58+
5359
def __init__(
5460
self,
5561
n_layers=2,

aeon/networks/_disjoint_cnn.py

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ class DisjointCNNNetwork(BaseDeepLearningNetwork):
8484
(ICDMW). IEEE, 2021.
8585
"""
8686

87+
_config = {
88+
"python_dependencies": ["tensorflow"],
89+
"python_version": "<3.13",
90+
"structure": "encoder",
91+
}
92+
8793
def __init__(
8894
self,
8995
n_layers=4,

aeon/networks/_encoder.py

+1-26
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,8 @@ class EncoderNetwork(BaseDeepLearningNetwork):
4141
.. [1] Serrà et al. Towards a Universal Neural Network Encoder for Time Series
4242
In proceedings International Conference of the Catalan Association
4343
for Artificial Intelligence, 120--129 2018.
44-
45-
4644
"""
4745

48-
_config = {
49-
"python_dependencies": ["tensorflow"],
50-
"python_version": "<3.12",
51-
"structure": "encoder",
52-
}
53-
5446
def __init__(
5547
self,
5648
kernel_size=None,
@@ -89,8 +81,6 @@ def build_network(self, input_shape, **kwargs):
8981
"""
9082
import tensorflow as tf
9183

92-
tf.keras.config.enable_unsafe_deserialization()
93-
9484
self._kernel_size = (
9585
[5, 11, 21] if self.kernel_size is None else self.kernel_size
9686
)
@@ -117,22 +107,7 @@ def build_network(self, input_shape, **kwargs):
117107

118108
x = conv
119109

120-
# split attention
121-
122-
split_index = self._n_filters[-1] // 2
123-
124-
attention_multiplier_1 = tf.keras.layers.Softmax()(
125-
tf.keras.layers.Lambda(lambda x: x[:, :, :split_index])(conv)
126-
)
127-
attention_multiplier_2 = tf.keras.layers.Lambda(
128-
lambda x: x[:, :, split_index:]
129-
)(conv)
130-
131-
# attention mechanism
132-
133-
attention = tf.keras.layers.Multiply()(
134-
[attention_multiplier_1, attention_multiplier_2]
135-
)
110+
attention = tf.keras.layers.Attention()([conv, conv, conv])
136111

137112
# add fully connected hidden layer
138113

aeon/networks/_fcn.py

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class FCNNetwork(BaseDeepLearningNetwork):
4242
networks: a strong baseline, IJCNN, 2017
4343
"""
4444

45+
_config = {
46+
"python_dependencies": ["tensorflow"],
47+
"python_version": "<3.13",
48+
"structure": "encoder",
49+
}
50+
4551
def __init__(
4652
self,
4753
n_layers=3,

aeon/networks/_inception.py

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ class InceptionNetwork(BaseDeepLearningNetwork):
9090
}
9191
"""
9292

93+
_config = {
94+
"python_dependencies": ["tensorflow"],
95+
"python_version": "<3.13",
96+
"structure": "encoder",
97+
}
98+
9399
def __init__(
94100
self,
95101
n_filters=32,

aeon/networks/_lite.py

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class LITENetwork(BaseDeepLearningNetwork):
5252
arXiv preprint arXiv:2409.02869 (2024).
5353
"""
5454

55+
_config = {
56+
"python_dependencies": ["tensorflow"],
57+
"python_version": "<3.13",
58+
"structure": "encoder",
59+
}
60+
5561
def __init__(
5662
self,
5763
use_litemv=False,

aeon/networks/_mlp.py

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class MLPNetwork(BaseDeepLearningNetwork):
2727
networks: A strong baseline, IJCNN, 2017.
2828
"""
2929

30+
_config = {
31+
"python_dependencies": ["tensorflow"],
32+
"python_version": "<3.13",
33+
"structure": "encoder",
34+
}
35+
3036
def __init__(
3137
self,
3238
use_bias=True,

aeon/networks/_resnet.py

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ class ResNetNetwork(BaseDeepLearningNetwork):
6262
6363
"""
6464

65+
_config = {
66+
"python_dependencies": ["tensorflow"],
67+
"python_version": "<3.13",
68+
"structure": "encoder",
69+
}
70+
6571
def __init__(
6672
self,
6773
n_residual_blocks=3,

aeon/networks/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
class BaseDeepLearningNetwork(ABC):
1414
"""Abstract base class for deep learning networks."""
1515

16-
def __init__(self, soft_dependencies="tensorflow", python_version="<3.12"):
16+
def __init__(self, soft_dependencies="tensorflow", python_version="<3.13"):
1717
_check_soft_dependencies(soft_dependencies)
1818
_check_python_version(python_version)
1919
super().__init__()
2020

2121
_config = {
2222
"python_dependencies": ["tensorflow"],
23-
"python_version": "<3.12",
23+
"python_version": "<3.13",
2424
"structure": "encoder",
2525
}
2626

aeon/networks/tests/test_all_networks.py

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
_check_soft_dependencies,
1111
)
1212

13-
__maintainer__ = []
14-
1513
_networks = network_classes = [
1614
member[1] for member in inspect.getmembers(networks, inspect.isclass)
1715
]

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ all_extras = [
6969
"seaborn>=0.11.0",
7070
"statsmodels>=0.12.1",
7171
"stumpy>=1.5.1",
72-
"tensorflow>=2.14; python_version < '3.12'",
72+
"tensorflow>=2.14",
7373
"torch>=1.13.1",
7474
"tsfresh>=0.20.0",
7575
"tslearn>=0.5.2",
7676
"sparse"
7777
]
7878
dl = [
79-
"tensorflow>=2.14; python_version < '3.12'",
79+
"tensorflow>=2.14",
8080
]
8181
unstable_extras = [
8282
"mrsqm>=0.0.7,<0.1.0; platform_system != 'Windows' and python_version < '3.12'", # requires gcc and fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)

0 commit comments

Comments
 (0)