@@ -382,11 +382,11 @@ def fit(self, X, y, W=None):
382382
383383
384384 '''
385- self.classifier_ = check_krr_fit(classifier, K, X)
385+ z_classifier_ = check_krr_fit(classifier, K, X, y )
386386 '''
387- self . classifier_ = check_krr_fit (classifier , K , X , y ) #Pkz as weights
387+ z_classifier_ = check_krr_fit (classifier , K , X , y ) #Pkz as weights
388388
389- W = self . classifier_ .dual_coef_ .reshape (self .n_samples_in_ , - 1 ) #Pkz
389+ W = z_classifier_ .dual_coef_ .reshape (self .n_samples_in_ , - 1 ) #Pkz
390390
391391 # Use this instead of `self.classifier_.predict(K)`
392392 # so that we can handle the case of the pre-fitted classifier
@@ -400,9 +400,9 @@ def fit(self, X, y, W=None):
400400 try :
401401 check_is_fitted (classifier )
402402 except NotFittedError :
403- self . classifier_ .set_params (** classifier .get_params ())
404- self . classifier_ .X_fit_ = self .X_fit_
405- self . classifier_ ._check_n_features (self .X_fit_ , reset = True )
403+ z_classifier_ .set_params (** classifier .get_params ())
404+ z_classifier_ .X_fit_ = self .X_fit_
405+ z_classifier_ ._check_n_features (self .X_fit_ , reset = True )
406406 else :
407407 Z = y .copy ()
408408 if W is None :
@@ -430,16 +430,29 @@ def fit(self, X, y, W=None):
430430 else :
431431 self ._fit_svd_solver = "full"
432432
433- self ._fit (K , Z , W )
434-
433+ self ._fit (K , Z , W ) #gives us T, Pkt, self.pt__
434+
435+
436+ '''
437+ we now need Z = TPtz
438+
439+ self.classifier_ = check_cl_fit(classifier, K @ self.pkt, y) #Ptz as weights
440+ Extract weights from self.classifier_ to get Ptz
441+ Then, pxz_ = pxt @ ptz
442+
443+ And so then maybe we change the below code
444+ (originally for KPCovR, with self.pty replaced with self.ptz and self.pky replaced with self.pkz)
445+ '''
446+
447+
435448 self .ptk_ = self .pt__ @ K
436- self .pty_ = self .pt__ @ Y
449+ self .ptz_ = self .pt__ @ Y
437450
438451 if self .fit_inverse_transform :
439452 self .ptx_ = self .pt__ @ X
440453
441454 #self.pkz_ = self.pkt_self.ptz_
442- self .pky_ = self .pkt_ @ self .pty_
455+ self .pkz_ = self .pkt_ @ self .ptz_
443456
444457 self .components_ = self .pkt_ .T # for sklearn compatibility
445458 return self
@@ -457,12 +470,13 @@ def decision_function(self, X=None, T=None):
457470 K = self ._get_kernel (X , self .X_fit_ )
458471 if self .center :
459472 K = self .centerer_ .transform (K )
460- return K @ self .pky_
473+ return K @ self .pkz_
461474
462475 else :
463476 T = check_array (T )
464- return T @ self .pty_
477+ return T @ self .ptz_
465478
479+ #is there a reason why this predict function is different than the one in PCovc?
466480 def predict (self , X = None , T = None ):
467481 """Predicts class values from X or T."""
468482
@@ -590,7 +604,7 @@ def score(self, X, Y):
590604 K_VN = self .centerer_ .transform (K_VN )
591605 K_VV = self .centerer_ .transform (K_VV )
592606
593- y = K_VN @ self .pky_
607+ y = K_VN @ self .pkz_
594608 Lkrr = np .linalg .norm (Y - y ) ** 2 / np .linalg .norm (Y ) ** 2
595609
596610 t_n = K_NN @ self .pkt_
0 commit comments