コード例 #1
0
ファイル: main_pre.py プロジェクト: gitter-badger/digbeta
from ijcai15 import PersTour

#algo = PersTour('./Osaka', 'userVisits-Osak.csv')
#algo.recommend(0.0)
#algo.recommend(0.5)
#algo.recommend(0.5, time_based=False)
#algo.recommend(1.0)
#algo.recommend(1.0, time_based=False)

#algo = PersTour('./Edinburgh', 'userVisits-Edin.csv')
#algo.recommend(0.0)
#algo.recommend(0.5)
#algo.recommend(0.5, time_based=False)
#algo.recommend(1.0)
#algo.recommend(1.0, time_based=False)

#algo = PersTour('./Glasgow', 'userVisits-Glas.csv')
#algo.recommend(0.0)
#algo.recommend(0.5)
#algo.recommend(0.5, time_based=False)
#algo.recommend(1.0)
#algo.recommend(1.0, time_based=False)

#algo = PersTour('./Toronto', 'userVisits-Toro.csv')
algo = PersTour('./Toronto2', 'userVisits-Toro.csv')
algo.recommend(0.0)
#algo.recommend(0.5)
#algo.recommend(0.5, time_based=False)
#algo.recommend(1.0)
#algo.recommend(1.0, time_based=False)
コード例 #2
0
ファイル: experiment.py プロジェクト: cdawei/digbeta
    #    for k in range(weights.shape[0]):
    #        paramvec[l] = weights[k]
    #        values[k] = calc_mean_F1score(ptobj, trainset, enumseqs_dict, scorevec_dict, scoremat, paramvec)
    #    midx = values.argmax()
    #    print('best F1-score:', values[midx], ', best weight:', weights[midx])
    #    paramvec[l] = weights[midx]
    #plt.scatter(np.linspace(-1, 1, 21), values, marker='+')

    plt.show()
    input('...')


if __name__ == '__main__':
    dirname = './Edinburgh'
    basefilename = 'userVisits-Edin.csv'
    ptobj = PersTour(dirname, basefilename)
    ptobj.calc_metrics({x for x in range(len(ptobj.sequences))})

    # train and test sequences
    #seqtrainset, seqtestset = gen_train_test_set(ptobj)
    #print(len(seqtrainset), len(seqtestset))

    fname = 'train_test.set'
    seqtrainset, seqtestset = load_train_test_set(fname)

    #lengths = []
    #for seq in seqtrainset:
    #    lengths.append(len(ptobj.sequences[seq]))
    #plt.hist(lengths, bins=20)
    #plt.show()
    #input('...')