File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ def fit(
139139 def score (self , comparisons : pd .DataFrame ) -> pd .Series :
140140 """Return FS log2-likelihood ratio scores for each pair."""
141141 self ._check_fitted ()
142+ assert self .weights_ is not None # narrow Optional for type checker
142143 gamma = comparisons [self .variables_ ]
143144 w = self .weights_ .set_index ("variable" )
144145
@@ -162,8 +163,12 @@ def predict_proba(
162163 ) -> pd .Series :
163164 """Return posterior P(match | comparisons)."""
164165 self ._check_fitted ()
165- prior = float (self .prior_ if prior is None else prior )
166- k = (1.0 - prior ) / prior
166+ assert self .prior_ is not None # narrow Optional for type checker
167+ if prior is None :
168+ p_val = float (self .prior_ )
169+ else :
170+ p_val = float (prior )
171+ k = (1.0 - p_val ) / p_val
167172 s = self .score (comparisons ).to_numpy (float )
168173 return pd .Series (1.0 / (1.0 + k * (2.0 ** (- s ))), index = comparisons .index )
169174
You can’t perform that action at this time.
0 commit comments