@@ -535,7 +535,7 @@ def target_function(guess, m, s):
535535class EnsembleDistribution :
536536 """Represents an arbitrary distribution as a weighted sum of several concrete distribution types."""
537537
538- _distribution_map = {
538+ distribution_map = {
539539 "betasr" : Beta ,
540540 "exp" : Exponential ,
541541 "gamma" : Gamma ,
@@ -567,13 +567,13 @@ def get_parameters(
567567 mean : Parameter = None ,
568568 sd : Parameter = None ,
569569 ) -> tuple [pd .DataFrame , dict [str , pd .DataFrame ]]:
570- expected_columns = list (cls ._distribution_map .keys ())
570+ expected_columns = list (cls .distribution_map .keys ())
571571
572572 weights = cls .fill_missing_weights (weights , expected_columns )
573573 weights = format_data (weights , expected_columns , "weights" )
574574
575575 params = {}
576- for name , dist in cls ._distribution_map .items ():
576+ for name , dist in cls .distribution_map .items ():
577577 try :
578578 param = parameters [name ] if parameters else None
579579 params [name ] = dist .get_parameters (param , mean , sd )
@@ -631,9 +631,7 @@ def pdf(self, x: pd.Series | np.ndarray | float | int) -> pd.Series | np.ndarray
631631 for name , parameters in self .parameters .items ():
632632 w = weights .loc [computable , name ]
633633 params = parameters .loc [computable ] if len (parameters ) > 1 else parameters
634- p += w * self ._distribution_map [name ](parameters = params ).pdf (
635- x .loc [computable ]
636- )
634+ p += w * self .distribution_map [name ](parameters = params ).pdf (x .loc [computable ])
637635
638636 if single_val :
639637 p = p .iloc [0 ]
@@ -682,7 +680,7 @@ def ppf(
682680 if len (parameters ) > 1
683681 else parameters
684682 )
685- x [idx ] = self ._distribution_map [name ](parameters = params ).ppf (q [idx ])
683+ x [idx ] = self .distribution_map [name ](parameters = params ).ppf (q [idx ])
686684
687685 if single_val :
688686 x = x .iloc [0 ]
@@ -706,9 +704,7 @@ def cdf(self, x: pd.Series | np.ndarray | float | int) -> pd.Series | np.ndarray
706704 for name , parameters in self .parameters .items ():
707705 w = weights .loc [computable , name ]
708706 params = parameters .loc [computable ] if len (parameters ) > 1 else parameters
709- c += w * self ._distribution_map [name ](parameters = params ).cdf (
710- x .loc [computable ]
711- )
707+ c += w * self .distribution_map [name ](parameters = params ).cdf (x .loc [computable ])
712708
713709 if single_val :
714710 c = c .iloc [0 ]
0 commit comments