def addPattern(self, x, i) : if type(x) == type(numpy.array(1)) or type(x) == type([]) : values = arrayWrap.doubleVector(x) else: raise TypeError, "data vectors must be list or array" self.container.addPattern(self, values)
def addPattern(self, x, i): if type(x) == type(numpy.array(1)) or type(x) == type([]): values = arrayWrap.doubleVector(x) else: raise TypeError, "data vectors must be list or array" self.container.addPattern(self, values)
def runGradientDescent(classifier, data): C = classifier.getClist(data) alphaVec = arrayWrap.doubleVector() cgist.runGradientDescent(data.castToBase(), C, alphaVec, int(classifier.cacheSize), 10000) alpha = [alphaVec[i] for i in range(len(alphaVec))] return alpha, 0.0
def addPattern(self, x, i): if type(x) == type({}): keys, values = arrayWrap.dict2vectors(x) elif type(x) == type(numpy.array(1)) or type(x) == type([]): keys = arrayWrap.longVector([]) values = arrayWrap.doubleVector(x) else: raise TypeError, "data vectors must be dictionary, list or arrays" self.container.addPattern(self, keys, values)
def test(self, data, **args) : testStart = time.clock() if data.testingFunc is not None : data.test(self.trainingData, **args) cdecisionFunc = arrayWrap.doubleVector([]) cY = self.ckmeans.test(data.castToBase(), cdecisionFunc) res.log.testingTime = time.clock() - testStart
def addPattern(self, x, i) : if type(x) == type({}) : keys,values = arrayWrap.dict2vectors(x) elif type(x) == type(numpy.array(1)) or type(x) == type([]) : keys = arrayWrap.longVector([]) values = arrayWrap.doubleVector(x) else: raise TypeError,"data vectors must be dictionary, list or arrays" self.container.addPattern(self, keys, values)
def test(self, data, **args): testStart = time.clock() if data.testingFunc is not None: data.test(self.trainingData, **args) cdecisionFunc = arrayWrap.doubleVector([]) cY = self.ckmeans.test(data.castToBase(), cdecisionFunc) res.log.testingTime = time.clock() - testStart