motorpong.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:cebl 作者: idfah 项目源码 文件源码
def trainClassifier(self):
        if self.trainCap is None:
            raise Exception('No data available for training.')

        nFold = self.nTrainTrial
        dialog = wx.ProgressDialog('Training Classifier',
                    'Featurizing', maximum=nFold+1,
                    style=wx.PD_ELAPSED_TIME | wx.PD_SMOOTH)

        segmented = self.trainCap.segment(start=0.0, end=self.trainTrialSecs)
        segs = [segmented.select(matchFunc=lambda mark: self.markToStim(mark) == choice)
                for choice in self.choices]

        assert segs[0].getNSeg() == self.nTrainTrial
        assert segs[1].getNSeg() == self.nTrainTrial

        # split segments
        segs = [cls.split(self.width, self.overlap) for cls in segs]

        ##print 'nSplit segs: ', segs[0].getNSeg()

        if self.method == 'Welch Power':
            self.trainWelch(segs, dialog)
        elif self.method == 'Autoregressive':
            self.trainAutoreg(segs, dialog)
        else:
            raise Exception('Invalid method: %s.' % str(self.method))

        if self.gameActive:
            self.plotPanel.showPong()
        else:
            self.plotPanel.showPieMenu()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号