Ejemplo n.º 1
0
def main(nome,nTest=None,K_0=20,K_1=10,K_2=5,K_3=3,K_4=20,dataset='ml-100k',path='/home/matteo/Desktop/DataMining/ml-100k/',X=0,Y=0):

    if dataset == 'ml-100k':
        path='/home/matteo/Desktop/DataMining/ml-100k/'
        X=1682
        Y=943
    elif dataset == 'ml-1m':
        path='/home/matteo/Desktop/DataMining/ml-1m/'
        X=3952
        Y=6040
    elif dataset == 'yelp':
        path='/home/matteo/Desktop/DataMining/yelp_dataset_academic/'
        X=13490
        Y=130873

    PATH = __initData(path,nome,dataset,K_0,nTest)

    print PATH

    # ############ Costruzione dataset SENZA ITEM con MINIMO RW 5 ############
    # #Seleziono tutto il dataset come data training (dataset = 0)
    # __WriteMatrixCF__(0,path,PATH,X,Y)
    # #Estraggo la lista degli oggetti
    # Item = __getMatrixCF_ITEM__(PATH,X)
    # #Estraggo la lista degli id degli oggetti con meno di 5 rw
    # Itemlist = __listaItemEliminati__(Item,5)
    # #Ricalcolo data-set e training-set sulla base della percentuale K_0, tutti le rw contenenti
    # # gli oggetti in Itemlist saranno eliminate
    # __WriteMatrixCF__(K_0,path,PATH,X,Y,Itemlist)
    #
    # #Istanzio le liste di utenti per i dati di training e test set
    # User = __getMatrixCF__(PATH)
    # UserTest = __getMatrixCF_TESTSET__(PATH)
    #
    # #########################################################################


    ############ Costruzione dataset sulla base del parametro K_0 ############

    __WriteMatrixCF__(K_0,path,PATH,X,Y)

    Item = __getMatrixCF_ITEM__(PATH,X)
    User = __getMatrixCF__(PATH)
    UserTest = __getMatrixCF_TESTSET__(PATH)

    ##########################################################################

    print "----------------"
    #Calcolo/Leggo la matrice di Similarità
    SimMatrix = __simil_UxU_ObjFull__(User,K_4,Y,PATH,Written=True)

    #Lancio il Racommander System sul dataset
    __addNote(path,__recSystemObjUxU__(User,UserTest,SimMatrix,PATH,K_1,K_2,K_3))

    print "----------------"
Ejemplo n.º 2
0
def main(nome,
         nTest=None,
         K_0=20,
         K_1=10,
         K_2=5,
         K_3=3,
         K_4=20,
         dataset='ml-100k',
         path='/home/matteo/Desktop/DataMining/ml-100k/',
         X=0,
         Y=0):

    if dataset == 'ml-100k':
        path = '/home/matteo/Desktop/DataMining/ml-100k/'
        X = 1682
        Y = 943
    elif dataset == 'ml-1m':
        path = '/home/matteo/Desktop/DataMining/ml-1m/'
        X = 3952
        Y = 6040
    elif dataset == 'yelp':
        path = '/home/matteo/Desktop/DataMining/yelp_dataset_academic/'
        X = 13490
        Y = 130873

    PATH = __initData(path, nome, dataset, K_0, nTest)

    print PATH

    # ############ Costruzione dataset SENZA ITEM con MINIMO RW 5 ############
    # #Seleziono tutto il dataset come data training (dataset = 0)
    # __WriteMatrixCF__(0,path,PATH,X,Y)
    # #Estraggo la lista degli oggetti
    # Item = __getMatrixCF_ITEM__(PATH,X)
    # #Estraggo la lista degli id degli oggetti con meno di 5 rw
    # Itemlist = __listaItemEliminati__(Item,5)
    # #Ricalcolo data-set e training-set sulla base della percentuale K_0, tutti le rw contenenti
    # # gli oggetti in Itemlist saranno eliminate
    # __WriteMatrixCF__(K_0,path,PATH,X,Y,Itemlist)
    #
    # #Istanzio le liste di utenti per i dati di training e test set
    # User = __getMatrixCF__(PATH)
    # UserTest = __getMatrixCF_TESTSET__(PATH)
    #
    # #########################################################################

    ############ Costruzione dataset sulla base del parametro K_0 ############

    __WriteMatrixCF__(K_0, path, PATH, X, Y)

    Item = __getMatrixCF_ITEM__(PATH, X)
    User = __getMatrixCF__(PATH)
    UserTest = __getMatrixCF_TESTSET__(PATH)

    ##########################################################################

    print "----------------"
    #Calcolo/Leggo la matrice di Similarità
    SimMatrix = __simil_UxU_ObjFull__(User, K_4, Y, PATH, Written=True)

    #Lancio il Racommander System sul dataset
    __addNote(
        path,
        __recSystemObjUxU__(User, UserTest, SimMatrix, PATH, K_1, K_2, K_3))

    print "----------------"
Ejemplo n.º 3
0
def main(nome,
         test,
         nTest=None,
         dataset='ml-100k',
         path='/home/matteo/Desktop/DataMining/ml-100k/',
         X=0,
         Y=0):

    if dataset == 'ml-100k':
        path = '/home/matteo/Desktop/DataMining/ml-100k/'
        X = 1682
        Y = 943
    elif dataset == 'ml-1m':
        path = '/home/matteo/Desktop/DataMining/ml-1m/'
        X = 3952
        Y = 6040
    elif dataset == 'yelp':
        path = '/home/matteo/Desktop/DataMining/yelp_dataset_academic/'
        X = 13490
        Y = 130873

    PATH = __initData(path, nome, dataset, test, nTest)

    print PATH
    #__addNote(path,'prova note')

    __WriteMatrixCF__(test, path, PATH, X, Y)
    Item = __getMatrixCF_ITEM__(PATH, X)
    User = __getMatrixCF__(PATH)
    UserTest = __getMatrixCF_TESTSET__(PATH)
    #
    # print "----------------"
    #
    # SimMatrix = __simil_UxU_ObjFull__(User,test,Y,PATH,Written=False)
    #
    #
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))
    #
    # print "----------------"
    #
    # SimiliIxI = __simil_IxI_ObjFull__(Item,test,X,PATH,Written=False)
    #
    # __addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI,Y,PATH))
    #
    #
    # print "----------------"
    #
    SimiliIxI2 = __simil_IxI_ObjFull2__(Item, test, X, PATH, Written=False)

    __addNote(
        path,
        __recSystemObjIxI__(test, User, UserTest, Item, SimiliIxI2, Y, PATH))

    #calcolo con item in meno del dataset su base percentile
    # __WriteMatrixCF__(test,path,PATH,X,Y)
    # Item = __getMatrixCF_ITEM__(PATH,X)

    # Itemlist = __listaItemEliminati__(Item,13)
    # __WriteMatrixCF__(test,path,PATH,X,Y,Itemlist)

    # Item = __getMatrixCF_ITEM__(PATH,X)
    # User = __getMatrixCF__(PATH)
    # UserTest = __getMatrixCF_TESTSET__(PATH)

    print "----------------"

    # SimMatrix = __simil_UxU_ObjFull__(User,test,Y,PATH,Written=False)
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))

    # print "----------------"

    # SimMatrix = __simil_UxU_ObjFull2__(User,test,Y,PATH,Written=False)
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))

    # print "----------------"

    # SimiliIxI = __simil_IxI_ObjFull__(Item,test,X,PATH,Written=False)
    # __addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI,Y,PATH))

    # print "----------------"

    #SimiliIxI2 = __simil_IxI_ObjFull2__(Item,test,X,PATH,Written=False)
    #__addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI2,Y,PATH))


#if __name__ == "__main__":
#main('TEST_FullData',10,0,dataset='ml-1m')
Ejemplo n.º 4
0
def main(nome,test,nTest=None,dataset='ml-100k',path='/home/matteo/Desktop/DataMining/ml-100k/',X=0,Y=0):

    if dataset == 'ml-100k':
        path='/home/matteo/Desktop/DataMining/ml-100k/'
        X=1682
        Y=943
    elif dataset == 'ml-1m':
        path='/home/matteo/Desktop/DataMining/ml-1m/'
        X=3952
        Y=6040
    elif dataset == 'yelp':
        path='/home/matteo/Desktop/DataMining/yelp_dataset_academic/'
        X=13490
        Y=130873

    PATH = __initData(path,nome,dataset,test,nTest)

    print PATH
    #__addNote(path,'prova note')





    __WriteMatrixCF__(test,path,PATH,X,Y)
    Item = __getMatrixCF_ITEM__(PATH,X)
    User = __getMatrixCF__(PATH)
    UserTest = __getMatrixCF_TESTSET__(PATH)
    #
    # print "----------------"
    #
    # SimMatrix = __simil_UxU_ObjFull__(User,test,Y,PATH,Written=False)
    #
    #
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))
    #
    # print "----------------"
    #
    # SimiliIxI = __simil_IxI_ObjFull__(Item,test,X,PATH,Written=False)
    #
    # __addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI,Y,PATH))
    #
    #
    # print "----------------"
    #
    SimiliIxI2 = __simil_IxI_ObjFull2__(Item,test,X,PATH,Written=False)
    
    __addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI2,Y,PATH))


    #calcolo con item in meno del dataset su base percentile
    # __WriteMatrixCF__(test,path,PATH,X,Y)
    # Item = __getMatrixCF_ITEM__(PATH,X)

    # Itemlist = __listaItemEliminati__(Item,13)
    # __WriteMatrixCF__(test,path,PATH,X,Y,Itemlist)

    # Item = __getMatrixCF_ITEM__(PATH,X)
    # User = __getMatrixCF__(PATH)
    # UserTest = __getMatrixCF_TESTSET__(PATH)

    print "----------------"

    # SimMatrix = __simil_UxU_ObjFull__(User,test,Y,PATH,Written=False)
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))

    # print "----------------"

    # SimMatrix = __simil_UxU_ObjFull2__(User,test,Y,PATH,Written=False)
    # __addNote(path,__recSystemObjUxU__(test,User,UserTest,SimMatrix,Y,PATH))

    # print "----------------"

    # SimiliIxI = __simil_IxI_ObjFull__(Item,test,X,PATH,Written=False)
    # __addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI,Y,PATH))

    # print "----------------"

    #SimiliIxI2 = __simil_IxI_ObjFull2__(Item,test,X,PATH,Written=False)
    #__addNote(path,__recSystemObjIxI__(test,User,UserTest,Item,SimiliIxI2,Y,PATH))



#if __name__ == "__main__":
    #main('TEST_FullData',10,0,dataset='ml-1m')