diff --git a/copulas/bivariate/base.py b/copulas/bivariate/base.py index a12c7bef..7f5dc026 100644 --- a/copulas/bivariate/base.py +++ b/copulas/bivariate/base.py @@ -341,7 +341,7 @@ def partial_derivative_scalar(self, U, V): self.check_fit() X = np.column_stack((U, V)) - return self.partial_derivative(X) + return self.partial_derivative(X).item() def set_random_state(self, random_state): """Set the random state. diff --git a/copulas/bivariate/frank.py b/copulas/bivariate/frank.py index 76f29dd1..6879630a 100644 --- a/copulas/bivariate/frank.py +++ b/copulas/bivariate/frank.py @@ -166,5 +166,5 @@ def _tau_to_theta(self, alpha): def debye(t): return t / (np.exp(t) - 1) - debye_value = integrate.quad(debye, EPSILON, alpha)[0] / alpha + debye_value = integrate.quad(debye, EPSILON, alpha.item())[0] / alpha return 4 * (debye_value - 1) / alpha + 1 - self.tau diff --git a/copulas/multivariate/tree.py b/copulas/multivariate/tree.py index 0eea1d0e..bc939f6a 100644 --- a/copulas/multivariate/tree.py +++ b/copulas/multivariate/tree.py @@ -202,8 +202,8 @@ def get_likelihood(self, uni_matrix): for i in range(num_edge): edge = self.edges[i] value, left_u, right_u = edge.get_likelihood(uni_matrix) - new_uni_matrix[edge.L, edge.R] = left_u - new_uni_matrix[edge.R, edge.L] = right_u + new_uni_matrix[edge.L, edge.R] = left_u.item() + new_uni_matrix[edge.R, edge.L] = right_u.item() values[0, i] = np.log(value) return np.sum(values), new_uni_matrix diff --git a/copulas/multivariate/vine.py b/copulas/multivariate/vine.py index 2c786ad4..25bc7595 100644 --- a/copulas/multivariate/vine.py +++ b/copulas/multivariate/vine.py @@ -329,7 +329,7 @@ def _sample_row(self): new_x = self.ppfs[current](np.array([tmp])) - sampled[current] = new_x + sampled[current] = new_x.item() for s in neighbors: if s not in visited: diff --git a/tasks.py b/tasks.py index d2522cdf..353b0733 100644 --- a/tasks.py +++ b/tasks.py @@ -21,6 +21,9 @@ '<=': operator.le, '==': operator.eq, } +EXTERNAL_DEPENDENCY_CAPS = { + 'scikit-learn': '1.8.0' +} if not hasattr(inspect, 'getargspec'): @@ -110,6 +113,8 @@ def install_minimum(c): if minimum_versions: install_deps = ' '.join(minimum_versions) c.run(f'python -m pip install {install_deps}') + for dep, cap in EXTERNAL_DEPENDENCY_CAPS.items(): + c.run(f'python -m pip install "{dep}<{cap}"') @task diff --git a/tests/unit/bivariate/test_base.py b/tests/unit/bivariate/test_base.py index 6fb2a400..5b81e72a 100644 --- a/tests/unit/bivariate/test_base.py +++ b/tests/unit/bivariate/test_base.py @@ -105,12 +105,13 @@ def test_partial_derivative_scalar(self, derivative_mock): # Setup instance = Bivariate(copula_type=CopulaTypes.CLAYTON) instance.fit(self.X) + derivative_mock.return_value = np.array([1.0]) # Run result = instance.partial_derivative_scalar(0.5, 0.1) # Check - assert result == derivative_mock.return_value + assert result == 1.0 expected_args = ((np.array([[0.5, 0.1]]), 0), {}) assert len(expected_args) == len(derivative_mock.call_args)