Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
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)
Exemplo n.º 6
0
    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
Exemplo n.º 7
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)
Exemplo n.º 8
0
    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