Skip to content

Commit d42ee14

Browse files
committed
changes
1 parent f57dfd4 commit d42ee14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

skpro/regression/unconditional_distfit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class UnconditionalDistfitRegressor(BaseProbaRegressor):
4848
"tests:vm": True, # set True if special VM is needed
4949
}
5050

51+
5152
def __init__(self, distr_type="norm", random_state=None, fit_histogram=False):
5253
"""
5354
Initialize UnconditionalDistfitRegressor.
@@ -117,7 +118,11 @@ def mean(self):
117118
return self.distfit_obj.model.mean()
118119

119120
def var(self):
120-
return self.distfit_obj.model.var()
121+
# For normal/laplace, variance is scale**2
122+
model = self.distfit_obj.model
123+
if isinstance(model, dict) and "scale" in model:
124+
return model["scale"] ** 2
125+
raise AttributeError("distfit model does not have a 'scale' (variance) attribute")
121126

122127
def get_params(self, deep=True):
123128
"""Return parameters of the distribution."""

0 commit comments

Comments
 (0)