def simple(): from util import reader r = reader.stringSepReader("u.data", "\t") from util import split train, test1 = split.split(r.getR(), 1234567890) from recommender import nonpersonalized c = nonpersonalized.randomRec(r.getR(), 3284092) from util import test test.auc(test1, c.getRec, r)
def slopeone(): from util import reader r = reader.tabSepReader("u.data") from util import split train, test1 = split.split(r.getR(), 12320894329854567890) from recommender import slopeone so = slopeone.slopeone(train) # import cPickle # output = open("slopeone.npz", "wb") # cPickle.dump(so, output, -1) # output.close() # inputfile = open("slopeone.npz", "rb") # so = cPickle.load(inputfile) # inputfile.close() from util import test test.auc(test1, so.getRec, r)