@@ -171,18 +171,19 @@ def warnings(self):
171
171
# Generate a global warning for divergences
172
172
n_divs = self ._num_divs_sample
173
173
if n_divs and self ._samples_after_tune == n_divs :
174
- msg = ('The chain contains only diverging samples. The model is '
175
- ' probably misspecified.' )
176
- warning = SamplerWarning (
177
- WarningType . DIVERGENCES , msg , 'error' , None , None , None )
178
- warnings . append ( warning )
174
+ message = ('The chain contains only diverging samples. The model '
175
+ 'is probably misspecified.' )
176
+ elif n_divs == 1 :
177
+ message = ( 'There was 1 divergence after tuning. Increase '
178
+ '`target_accept` or reparameterize.' )
179
179
elif n_divs > 0 :
180
180
message = ('There were %s divergences after tuning. Increase '
181
181
'`target_accept` or reparameterize.'
182
182
% n_divs )
183
- warning = SamplerWarning (
184
- WarningType .DIVERGENCES , message , 'error' , None , None , None )
185
- warnings .append (warning )
186
183
184
+ warning = SamplerWarning (
185
+ WarningType .DIVERGENCES , message , 'error' , None , None , None )
186
+ warnings .append (warning )
187
187
warnings .extend (self .step_adapt .warnings ())
188
+
188
189
return warnings
0 commit comments