Exemplo n.º 1
0
def run():
    #Get Parameter
    data = param.parameter(15,15,5)
    data.get_sample()
    #Get SVD_Data
    MF = sgd.SGD(0.001,0.0001)
    MF.iteration(data,2000)
    #Outuout Result
    MF.re(data)
Exemplo n.º 2
0
def run():
    #Get Parameter
    data = param.parameter(15, 15, 5)
    data.get_sample()
    #Get SVD_Data
    MF = sgd.SGD(0.001, 0.0001)
    MF.iteration(data, 2000)
    #Outuout Result
    MF.re(data)
Exemplo n.º 3
0
import param


class ubcf:
    def usersim(self, data, x, y):
        return 1 - scipy.spatial.distance.cosine(x, y)

    def recommend_calc(self, data):
        for u, i in data.Matrix.items():
            for item, rate in data.Matrix[u].items():
                print rate


if __name__ == "__main__":
    data = param.parameter(5, 5)
    data.get_sample()
    print data.Matrix
Exemplo n.º 4
0
def display(data):
    print "Mode1:U(1)"
    print data.Mode1Matrix
    print
    print "Mode2:U(2)"
    print data.Mode2Matrix
    print
    print "Mode3:U(3)"
    print data.Mode3Matrix
    print


def run(data):
    data.get_sample()
    tf = tensor.HOSVD()
    for mode in range(1, 4):
        tf.unfolding(data, mode)
    display(data)
    print "CoreTensor:"
    tf.core_calc(data)
    data.tensor_display(data.coreTensor)


if __name__ == "__main__":
    start = time.time()
    data = param.parameter(5, 4, 3)
    run(data)
    Run_time = time.time() - start
    print "Run_time:" + str(Run_time)
Exemplo n.º 5
0
 def __init__(self):
     QWidget.__init__(self)
     self.setWindowTitle("Chess")
     self.param = parameter()
     self.initUI()
Exemplo n.º 6
0
import param

class ubcf:
    def usersim(self,data,x,y):
        return 1 - scipy.spatial.distance.cosine(x,y)

    def recommend_calc(self,data):
        for u,i in data.Matrix.items():
            for item,rate in data.Matrix[u].items():
                print rate


if __name__=="__main__":
    data = param.parameter(5,5)
    data.get_sample()
    print data.Matrix

Exemplo n.º 7
0
 def __init__(self, block, blocks):
     self.block = block
     self.blocks = blocks
     self.param = parameter()