-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't workingmodelsHas to do with the modelsHas to do with the models
Description
Summary
The normal_known_variance_inputs helper function doesn't include the required var parameter that the normal_known_variance model expects.
Current Behavior
from conjugate.helpers import normal_known_variance_inputs
data = [2.3, 1.9, 2.7, 2.1, 2.5]
inputs = normal_known_variance_inputs(data)
# Returns: {'x_total': 11.5, 'n': 5}Expected Behavior
The helper should optionally accept and return the var parameter:
inputs = normal_known_variance_inputs(data, var=0.5)
# Returns: {'x_total': 11.5, 'n': 5, 'var': 0.5}Problem
The model signature requires var:
def normal_known_variance(*, x_total, n, var, prior):Currently users must do:
posterior = normal_known_variance(**inputs, var=0.5, prior=prior)This breaks the pattern shown in documentation where helpers provide all required inputs.
Suggested Fix
def normal_known_variance_inputs(x, *, var=None, sum_fn=None, len_fn=None):
result = {
"x_total": sum_fn(x),
"n": len_fn(x),
}
if var is not None:
result["var"] = var
return resultAlso Affects
normal_known_precision_inputs- missingprecisionparameter
Related
- Helper function
normal_known_mean_inputsmissingmuparameter #286 - Similar issue withnormal_known_mean_inputs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingmodelsHas to do with the modelsHas to do with the models