当前位置: 首页>>代码示例>>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;未经允许,请勿转载。