@@ -64,9 +64,9 @@ class INKClassifier(BaseClassifier):
6464 ... ink_classifier.predict_proba(event)
6565 ... )
6666 ...
67- True 0.64105 ...
68- False 0.44438 ...
69- True 0.64909 ...
67+ True 0.64839 ...
68+ False 0.43767 ...
69+ True 0.65660 ...
7070 >>> ink_classifier.get_params(deep=False) # doctest:+ELLIPSIS
7171 {...'learner_meta_weights': LearnerMetaWeights(novelty_weights=Weights(\
7272 mean=0.20461..., variance=0.45871...), interest_weights=Weights(\
@@ -174,9 +174,9 @@ def __eval_matching_quality(
174174 bias_weights .mean * pred_bias ,
175175 ]
176176 team_learner_variance = [
177- novelty_weights .variance * pred_novelty ,
178- interest_weights .variance * pred_interest ,
179- bias_weights .variance * pred_bias ,
177+ novelty_weights .variance * ( pred_novelty ** 2 ) ,
178+ interest_weights .variance * ( pred_interest ** 2 ) ,
179+ bias_weights .variance * ( pred_bias ** 2 ) ,
180180 ]
181181 team_content_mean = [self ._threshold ]
182182 team_content_variance = []
@@ -203,21 +203,13 @@ def __create_env(self):
203203 def __update_weights (
204204 self ,
205205 x : EventModel ,
206- pred_novelty : float ,
207- pred_interest : float ,
208206 pred_actual : float ,
209207 ) -> None :
210208 """Update the weights of novelty, interest and bias.
211209
212210 Args:
213211 x:
214212 A representation of the learning event.
215- pred_novelty:
216- The predicted probability of the learner's engagement by using
217- NoveltyClassifier.
218- pred_interest:
219- The predicted probability of the learner's engagement by using
220- InterestClassifier.
221213 pred_actual:
222214 Whether the learner actually engages in the given event. This value is
223215 either 0 or 1.
@@ -228,6 +220,9 @@ def __update_weights(
228220 if self ._greedy and cur_pred == pred_actual :
229221 return
230222
223+ pred_novelty = self ._novelty_classifier .predict_proba (x )
224+ pred_interest = self ._interest_classifier .predict_proba (x )
225+
231226 # train
232227 env = self .__create_env ()
233228 team_experts = (
@@ -278,11 +273,7 @@ def __update_weights(
278273 def fit (self , x : EventModel , y : bool ) -> Self :
279274 self ._novelty_classifier .fit (x , y )
280275 self ._interest_classifier .fit (x , y )
281-
282- pred_novelty = self ._novelty_classifier .predict_proba (x )
283- pred_interest = self ._interest_classifier .predict_proba (x )
284-
285- self .__update_weights (x , pred_novelty , pred_interest , y )
276+ self .__update_weights (x , y )
286277 return self
287278
288279 def predict (self , x : EventModel ) -> bool :
0 commit comments