本文整理匯總了Python中Classifier.Classifier.setDataContainer方法的典型用法代碼示例。如果您正苦於以下問題:Python Classifier.setDataContainer方法的具體用法?Python Classifier.setDataContainer怎麽用?Python Classifier.setDataContainer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Classifier.Classifier
的用法示例。
在下文中一共展示了Classifier.setDataContainer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: LearnerBuilder
# 需要導入模塊: from Classifier import Classifier [as 別名]
# 或者: from Classifier.Classifier import setDataContainer [as 別名]
#.........這裏部分代碼省略.........
return self.__foldingPolicyDescriptor
##
# Signals to use N-fold cross validation with stratified folding rule
#
# @return: FoldingDescriptor
##
def withStratifiedFoldingPolicy(self):
self.__foldingPolicyDescriptor = LearnerBuilder.FoldingDescriptor(self, LearnerBuilder.FoldingDescriptor.STRATIFIED)
return self.__foldingPolicyDescriptor
##
# Signals to use N-fold cross validation from a set of files
#
# @return: FoldingDescriptor
##
def withFilesFoldingPolicy(self):
self.__foldingPolicyDescriptor = LearnerBuilder.FoldingDescriptor(self, LearnerBuilder.FoldingDescriptor.STRATIFIED)
return self.__foldingPolicyDescriptor
##
# Signals to use data from ARFF file for training dataset
#
# @param filename: Filename where to read the data from
# @param name: Category name, default: "train"
# @return: LearnerBuilder
##
def withTrainingDataFromARFFFile(self, filename, name="train"):
dataContainer = ARFFAdapter(filename).loadData(name)
if self.__learner.dataContainer != None:
self.__learner.setDataContainer(self.__learner.dataContainer.combine(dataContainer))
else:
self.__learner.setDataContainer(dataContainer)
return self
##
# Signals to use data from ARFF file for testing dataset
#
# @param filename: Filename where to read the data from
# @return: LearnerBuilder object itself
def withTestingDataFromARFFFile(self, filename):
dataContainer = ARFFAdapter(filename).loadData(DataContainer.TEST_CATEGORY)
if self.__learner.dataContainer != None:
self.__learner.setDataContainer(self.__learner.dataContainer.combine(dataContainer))
else:
self.__learner.setDataContainer(dataContainer)
return self
def withTrainingDataFromNumPyArray(self, points, values, name="train"):
dataContainer = DataContainer(points=points, values=values, name=name)
if self.__learner.dataContainer != None:
self.__learner.setDataContainer(self.__learner.dataContainer.combine(dataContainer))
else:
self.__learner.setDataContainer(dataContainer)
return self
def withTestingDataFromNumPyArray(self, points, values, name="test"):
return self.withTrainingDataFromNumPyArray(points, values, "test")