diff --git a/src/nemos/basis.py b/src/nemos/basis.py index 0b6eee9b..164936c7 100644 --- a/src/nemos/basis.py +++ b/src/nemos/basis.py @@ -1008,9 +1008,10 @@ def evaluate_on_grid(self, *n_samples: int) -> Tuple[Tuple[NDArray], NDArray]: Raises ------ ValueError - - If the time point number is inconsistent between inputs or if the number of inputs doesn't match what + If the time point number is inconsistent between inputs or if the number of inputs doesn't match what the Basis object requires. - - If one of the n_samples is <= 0. + ValueError + If one of the n_samples is <= 0. Notes ----- diff --git a/src/nemos/glm.py b/src/nemos/glm.py index d348028f..509d8beb 100644 --- a/src/nemos/glm.py +++ b/src/nemos/glm.py @@ -686,7 +686,7 @@ def fit( If ``init_params[i]`` cannot be converted to ``jnp.ndarray`` for all ``i`` Examples - ------- + -------- >>> # example input >>> import numpy as np >>> X, y = np.random.normal(size=(10, 2)), np.random.poisson(size=10) @@ -1516,12 +1516,17 @@ def fit( Raises ------ ValueError - - If ``init_params`` is not of length two. - - If dimensionality of ``init_params`` are not correct. - - If ``X`` is not two-dimensional. - - If ``y`` is not two-dimensional. - - If the ``feature_mask`` is not of the right shape. - - If solver returns at least one NaN parameter, which means it found + If ``init_params`` is not of length two. + ValueError + If dimensionality of ``init_params`` are not correct. + ValueError + If ``X`` is not two-dimensional. + ValueError + If ``y`` is not two-dimensional. + ValueError + If the ``feature_mask`` is not of the right shape. + ValueError + If solver returns at least one NaN parameter, which means it found an invalid solution. Try tuning optimization hyperparameters. TypeError If ``init_params`` are not array-like diff --git a/src/nemos/observation_models.py b/src/nemos/observation_models.py index e4bc407c..bea7b3d6 100644 --- a/src/nemos/observation_models.py +++ b/src/nemos/observation_models.py @@ -868,9 +868,11 @@ def check_observation_model(observation_model): If the `observation_model` does not have one of the required attributes. TypeError - - If an attribute is not a callable function. - - If a function does not return a jax.numpy.ndarray. - - If 'inverse_link_function' is not differentiable. + If an attribute is not a callable function. + TypeError + If a function does not return a jax.numpy.ndarray. + TypeError + If 'inverse_link_function' is not differentiable. Examples -------- diff --git a/src/nemos/simulation.py b/src/nemos/simulation.py index a2dc06d6..48af7008 100644 --- a/src/nemos/simulation.py +++ b/src/nemos/simulation.py @@ -60,8 +60,9 @@ def difference_of_gammas( Raises ------ ValueError: - - If any of the Gamma parameters is lesser or equal to 0. - - If the upper_percentile is not in [0, 1). + If any of the Gamma parameters is lesser or equal to 0. + ValueError: + If the upper_percentile is not in [0, 1). References ---------- @@ -247,7 +248,6 @@ def simulate_recurrent( inverse_link_function : The inverse link function for the observation model. - Returns ------- simulated_activity : @@ -294,7 +294,6 @@ def simulate_recurrent( >>> _ = plt.title("Simulated firing rates") >>> _ = plt.show() """ - if isinstance(feedforward_input, FeaturePytree): raise ValueError( "simulate_recurrent works only with arrays. " diff --git a/src/nemos/utils.py b/src/nemos/utils.py index 87ad0472..557b6c96 100644 --- a/src/nemos/utils.py +++ b/src/nemos/utils.py @@ -53,10 +53,11 @@ def validate_axis(tree: Any, axis: int): Raises ------ ValueError - - If the specified axis is equal to or greater than the number of dimensions (`ndim`) of any array + If the specified axis is equal to or greater than the number of dimensions (`ndim`) of any array within the tree. This ensures that operations intended for a specific axis can be safely performed on every array in the tree. - - If the axis is negative or non-integer. + ValueError + If the axis is negative or non-integer. """ if not isinstance(axis, int) or axis < 0: raise ValueError("`axis` must be a non negative integer.")