當前位置: 首頁>>代碼示例>>Python>>正文


Python Classifier.attachEventController方法代碼示例

本文整理匯總了Python中Classifier.Classifier.attachEventController方法的典型用法代碼示例。如果您正苦於以下問題:Python Classifier.attachEventController方法的具體用法?Python Classifier.attachEventController怎麽用?Python Classifier.attachEventController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Classifier.Classifier的用法示例。


在下文中一共展示了Classifier.attachEventController方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: LearnerBuilder

# 需要導入模塊: from Classifier import Classifier [as 別名]
# 或者: from Classifier.Classifier import attachEventController [as 別名]

#.........這裏部分代碼省略.........
    ##
    # Signals to use data from CSV file for testing dataset
    #
    # @param filename: Filename where to read the data from
    # @return: LearnerBuilder object itself
    def withTestingDataFromCSVFile(self, filename):
        dataContainer = CSVAdapter(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


    ##
    # Signals to use initial data for alpha vector from ARFF file
    #
    # @param filename: Filename where to read the data from
    # @return: LearnerBuilder object itself
    def withInitialAlphaFromARFFFile(self, filename):
        alpha = LearnedKnowledgeFormatter().deserializeFromFile(filename)
        self.__learner.alpha = alpha
        self.__learner.knowledge.setMemento(alpha)
        return self


    ##
    # Attaches checkpoint controller to the learner
    #
    # @param controller: Checkpoint controller which implements LearnerEventController
    # @return: LearnerBuilder
    def withCheckpointController(self, controller):
        self.__checkpointController = controller
        self.__learner.attachEventController(self.__checkpointController)
        self.__checkpointController.setGrid(self.__learner.grid)
        self.__checkpointController.setLearnedKnowledge(self.__learner.knowledge)
        self.__checkpointController.setLearner(self.__learner)
        return self


    ##
    # Attaches progress presentor to the learner
    #
    # @param presentor: progress presentor which implements LearnerEventController
    # @return: LearnerBuilder
    def withProgressPresenter(self, presentor):
        self.__learner.attachEventController(presentor)
        if self.__learner.solver != None:
            self.__learner.solver.attachEventController(presentor)
        return self



    ##
    # Grid Descriptor helps to implement fluid interface patter on python
    # it encapsulates functionality concerning creation of the grid
    class GridDescriptor:
        __builder = None
        __deg = None
        __level = None
        __file = None
        __border = None
        __dim = None


        ## Constructor
開發者ID:ABAtanasov,項目名稱:Sparse-Grids,代碼行數:70,代碼來源:LearnerBuilder.py


注:本文中的Classifier.Classifier.attachEventController方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。