Beispiel #1
0
                 "svr")
    sigma = [0]
    testimg, testdot, testmapping, testtags = Counter.prepareData(img, dot,
                                                                  sigma,
                                                                  normalize =
                                                                  False, smooth
                                                                  = True
                                                                  )
    #print "blub", testimg.shape
    #print testimg
    #print testdot, np.sum(testdot)
    boxConstraints = []
    #boxConstraints = [(12, img[:,:,:])]
    #boxConstraints = [(3, img[0:30,0:30,:])]
    #boxConstraints.reshape((-1, boxConstraints.shape[-1]))
    success = Counter.fitPrepared(testimg[testmapping,:], testdot[testmapping], testtags, epsilon = 0.000,
                                  boxConstraints = boxConstraints)
    #success = Counter.fitPrepared(testimg[indices,:], testdot[indices], testtags[:len(indices)], epsilon = 0.000)
    #print Counter.w, Counter.
    print "learning finished"

    #conversion step
    #Q = kernelize(B, method = "gaussian")
    ##Q = B * B.transpose()
    #tags = np.zeros(numVariables,dtype=np.int8)
    #tags[0:len(pindices)] = 1
    #tags[len(pindices):] = -1
    #c = dot[allIndices] * (-tags)+ epsilon
    #upperBounds = [None, pMult, lMult]
    #success,solution = optimize(tags,Q,c,upperBounds)
    ## Put model data into dense matrices
    #print Counter.b, Counter.w