本文整理汇总了Python中Classifier.Classifier.predictTarget方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.predictTarget方法的具体用法?Python Classifier.predictTarget怎么用?Python Classifier.predictTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classifier.Classifier
的用法示例。
在下文中一共展示了Classifier.predictTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import predictTarget [as 别名]
#.........这里部分代码省略.........
lo = 0
else:
lo = charEnds[i-1]
rowColBinList = em.getAveragedEpochs(hi,lo,isiList,maxSets)
finalDataArray = rowColBinList
classMarks = self.prepairTargetArray(self.getCharIndexes(self.targetLetters[i]))
if self.firsttrain == 1:
self.cl.learn(finalDataArray,classMarks,0)
self.firsttrain = 0
else:
self.cl.learn(finalDataArray,classMarks)
# Metoda hada cielove znaky a updatuje pouzivatelske rozhranie
def guessChars(self,subset,files,targetLetter,testProgress,progTestLabel,guessView,guessLab,maxSets):
aktCharNum = 0
totalChars = len(sum(targetLetter,[]))
if self.chanNum != 64:
files.sort()
files = self.createTriplets(files)
for m in range(len(files)):
# nacitanie a predspracovanie signalu
signalLoader = SignalLoader(self.chanNum,files[m])
prpr = Preprocessor(self.chanNum,subset)
signal, stimCode, phaseInSequence = signalLoader.loadSignal()
self.signal = prpr.preprocess(240,1E-1,30E0,self.sf,signal,stimCode,phaseInSequence,1)
self.stimulusCode = prpr.stimulusCode
self.phaseInSequence = prpr.phaseInSequence
if (len(targetLetter) > m):
self.targetLetters = targetLetter[m]
else:
self.targetLetters = []
print "Processing file:",m,"\n"
# najdenie prechodov medzi znakmi
charEnds = self.findCharEnds()
# rozdelenie dat do epoch
em = EpochManager(self.signal,self.stimulusCode,self.phaseInSequence)
isiList = em.createEpochs()
hit = 0
# hadanie jednotlivych znakov
for i in range(len(charEnds)):
testProgress["value"] = aktCharNum
progTestLabel["text"] = ("Hádam znak: {}/{}").format(aktCharNum+1, totalChars)
aktCharNum +=1
hi = charEnds[i]
if i == 0:
lo = 0
else:
lo = charEnds[i-1]
rowColBinList = em.getAveragedEpochs(hi,lo,isiList,maxSets)
finalDataArray = self.prepairSignalArray(self.sf.grandAveragingFilter(rowColBinList,subset,1))
#pomocou klasifikatora
char = self.cl.predictTarget(finalDataArray,self.cl.reduce(self.sf,self,subset))
if len(self.targetLetters) > i:
if char == self.targetLetters[i]:
hit+=1
print "Succesfully guessed char:",char,"\n"
else:
print "Guessed char:",char,"\n"
if i == 0:
text = "(" + char + ","
elif i == len(charEnds) - 1:
text = char + ")"
else:
text = char + ","
guessView.configure(state='normal')
guessView.insert(INSERT, text)
guessView.configure(state='disabled')
self.rate += (hit)*100/float(totalChars)
print "\n Success rate= ",self.rate, "\n"
guessLab["text"]=("Presnosť: {}").format(self.rate)
return self.rate
# Pomocna funkcia pre spracovanie csv suborov epoc dat
def createTriplets(self, epocFiles):
triplets = []
for i in range(len(epocFiles)/3):
triplet = []
triplet.append(epocFiles[i])
triplet.append(epocFiles[i+len(epocFiles)/3])
triplet.append(epocFiles[i+2*len(epocFiles)/3])
triplets.append(triplet)
return triplets