Skip to content

Commit

Permalink
Added some bad argument calue checking to SBR
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelbue committed Feb 6, 2024
1 parent 85a5db1 commit 1ec2523
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pysindy/optimizers/sbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ def __init__(

super().__init__(unbias=unbias, **kwargs)

# check that hyperparameters are positive.
if sparsity_coef_tau0 <= 0:
raise ValueError("sparsity_coef_tau0 must be positive")
if slab_shape_nu <= 0:
raise ValueError("slab_shape_nu must be positive")
if slab_shape_s <= 0:
raise ValueError("slab_shape_s must be positive")
if noise_hyper_lambda <= 0:
raise ValueError("noise_hyper_lambda must be positive")

# check that samples are positive integers.
if not isinstance(num_warmup, int) or num_warmup < 0:
raise ValueError("num_warmup must be a positive integer")
if not isinstance(num_samples, int) or num_samples < 0:
raise ValueError("num_samples must be a positive integer")

# set the hyperparameters
self.sparsity_coef_tau0 = sparsity_coef_tau0
self.slab_shape_nu = slab_shape_nu
Expand Down

0 comments on commit 1ec2523

Please sign in to comment.