示例#1
0
文件: base.py 项目: sspeng/MKLpy
	def decision_function(self,X):
		if self.is_fitted == False:
			raise NotFittedError("This KOMD instance is not fitted yet. Call 'fit' with appropriate arguments before using this method.")
		if self.multiclass_:
			raise ValueError('Scores are not available for multiclass problems, use predict')
		KL = process_list(X,self.generator)				# X can be a samples matrix or Kernel List
		return self.estimator.decision_function(self.how_to(KL,self.weights))
示例#2
0
	def decision_function(self,X):
		if self.is_fitted == False:
			raise NotFittedError("This KOMD instance is not fitted yet. Call 'fit' with appropriate arguments before using this method.")
		if self.multiclass_:
			raise ValueError('Scores are not available for multiclass problems, use predict')
		KL = process_list(X,self.generator)				# X can be a samples matrix or Kernel List
		return self.estimator.decision_function(self.how_to(KL,self.weights))
示例#3
0
文件: base.py 项目: ethiy/MKLpy
 def predict_proba(self, X):
     if not self.is_fitted:
         raise NotFittedError(
             "This KOMD instance is not fitted yet. Call 'fit' with appropriate arguments before using this method."
         )
     KL = process_list(X, self.generator)
     return self.clf.predict_proba(
         KL) if self.multiclass_ else self.estimator.predict_proba(
             self.how_to(KL, self.weights))
示例#4
0
文件: base.py 项目: sspeng/MKLpy
	def _prepare(self,X,Y):
		'''preprocess data before training'''
		check_classification_targets(Y)
		self.classes_ = np.unique(Y)
		if len(self.classes_) < 2:
			raise ValueError("The number of classes has to be almost 2; got ", len(self.classes_))
		self.multiclass_ = len(self.classes_) > 2

		KL = process_list(X,self.generator)				# X can be a samples matrix or Kernels List
		self.KL, self.Y = check_KL_Y(KL,Y)
		self.n_kernels = len(self.KL)
		return
示例#5
0
	def _prepare(self,X,Y):
		'''preprocess data before training'''
		check_classification_targets(Y)
		self.classes_ = np.unique(Y)
		if len(self.classes_) < 2:
			raise ValueError("The number of classes has to be almost 2; got ", len(self.classes_))
		self.multiclass_ = len(self.classes_) > 2

		KL = process_list(X,self.generator)				# X can be a samples matrix or Kernels List
		self.KL, self.Y = check_KL_Y(KL,Y)
		self.n_kernels = len(self.KL)
		return
示例#6
0
	def predict(self,X):
		if not self.is_fitted :
			raise NotFittedError("This KOMD instance is not fitted yet. Call 'fit' with appropriate arguments before using this method.")
		KL = process_list(X,self.generator)
		return self.clf.predict(KL) if self.multiclass_ else self.estimator.predict(self.how_to(KL,self.weights))