Skip to content

Commit 213980c

Browse files
authored
Add support for NumPy 2.4.0 (#498)
1 parent 297aa0f commit 213980c

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

copulas/bivariate/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def partial_derivative_scalar(self, U, V):
341341
self.check_fit()
342342

343343
X = np.column_stack((U, V))
344-
return self.partial_derivative(X)
344+
return self.partial_derivative(X).item()
345345

346346
def set_random_state(self, random_state):
347347
"""Set the random state.

copulas/bivariate/frank.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,5 @@ def _tau_to_theta(self, alpha):
166166
def debye(t):
167167
return t / (np.exp(t) - 1)
168168

169-
debye_value = integrate.quad(debye, EPSILON, alpha)[0] / alpha
169+
debye_value = integrate.quad(debye, EPSILON, alpha.item())[0] / alpha
170170
return 4 * (debye_value - 1) / alpha + 1 - self.tau

copulas/multivariate/tree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def get_likelihood(self, uni_matrix):
202202
for i in range(num_edge):
203203
edge = self.edges[i]
204204
value, left_u, right_u = edge.get_likelihood(uni_matrix)
205-
new_uni_matrix[edge.L, edge.R] = left_u
206-
new_uni_matrix[edge.R, edge.L] = right_u
205+
new_uni_matrix[edge.L, edge.R] = left_u.item()
206+
new_uni_matrix[edge.R, edge.L] = right_u.item()
207207
values[0, i] = np.log(value)
208208

209209
return np.sum(values), new_uni_matrix

copulas/multivariate/vine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def _sample_row(self):
329329

330330
new_x = self.ppfs[current](np.array([tmp]))
331331

332-
sampled[current] = new_x
332+
sampled[current] = new_x.item()
333333

334334
for s in neighbors:
335335
if s not in visited:

tasks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
'<=': operator.le,
2222
'==': operator.eq,
2323
}
24+
EXTERNAL_DEPENDENCY_CAPS = {
25+
'scikit-learn': '1.8.0'
26+
}
2427

2528

2629
if not hasattr(inspect, 'getargspec'):
@@ -110,6 +113,8 @@ def install_minimum(c):
110113
if minimum_versions:
111114
install_deps = ' '.join(minimum_versions)
112115
c.run(f'python -m pip install {install_deps}')
116+
for dep, cap in EXTERNAL_DEPENDENCY_CAPS.items():
117+
c.run(f'python -m pip install "{dep}<{cap}"')
113118

114119

115120
@task

tests/unit/bivariate/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ def test_partial_derivative_scalar(self, derivative_mock):
105105
# Setup
106106
instance = Bivariate(copula_type=CopulaTypes.CLAYTON)
107107
instance.fit(self.X)
108+
derivative_mock.return_value = np.array([1.0])
108109

109110
# Run
110111
result = instance.partial_derivative_scalar(0.5, 0.1)
111112

112113
# Check
113-
assert result == derivative_mock.return_value
114+
assert result == 1.0
114115

115116
expected_args = ((np.array([[0.5, 0.1]]), 0), {})
116117
assert len(expected_args) == len(derivative_mock.call_args)

0 commit comments

Comments
 (0)