Beispiel #1
0
def main(args):
    progress = WorkSplitter()

    table_path = 'tables/'

    test = load_numpy(path=args.path, name=args.dataset + args.test)

    df = pd.DataFrame({
        'model': [
            'AutoRec', 'AutoRec', 'AutoRec', 'InitFeatureEmbedAE',
            'InitFeatureEmbedAE', 'InitFeatureEmbedAE', 'AlterFeatureEmbedAE',
            'ConcatFeatureEmbedAE', 'UnionSampleAE', 'WRSampleAE',
            'BatchSampleAE', 'BridgeLabelAE', 'RefineLabelAE', 'DeepAutoRec',
            'DeepAutoRec', 'SoftLabelAE', 'HintAE'
        ],
        'way': [
            None, 'unif', 'combine', 'user', 'item', 'both', None, None, None,
            None, None, None, None, None, 'unif', None, None
        ]
    })

    progress.subsection("Reproduce")
    frame = []
    for idx, row in df.iterrows():
        row = row.to_dict()
        row['metric'] = ['NLL', 'AUC']
        row['rank'] = 200
        result = execute(test, row, folder=args.model_folder + args.dataset)
        frame.append(result)

    results = pd.concat(frame)
    save_dataframe_csv(results, table_path, args.name)
def main(args):
    progress = WorkSplitter()

    table_path = 'tables/'

    test = load_numpy(path=args.path, name=args.dataset + args.test)

    df = pd.DataFrame({
        'model': [
            "BiasedMF", "BiasedMF", "BiasedMF", "PropensityMF",
            "InitFeatureEmbedMF", "InitFeatureEmbedMF", "InitFeatureEmbedMF",
            "AlterFeatureEmbedMF", "ConcatFeatureEmbedMF", "CausalSampleMF",
            "UnionSampleMF", "WRSampleMF", "BatchSampleMF", "BridgeLabelMF",
            "RefineLabelMF"
        ],
        'way': [
            None, "unif", "combine", None, "user", "item", "both", None, None,
            None, None, None, None, None, None
        ]
    })

    progress.subsection("Reproduce")
    frame = []
    for idx, row in df.iterrows():
        row = row.to_dict()
        row['metric'] = ['NLL', 'AUC']
        row['rank'] = 10
        result = execute(test, row, folder=args.model_folder + args.dataset)
        frame.append(result)

    results = pd.concat(frame)
    save_dataframe_csv(results, table_path, args.name)
Beispiel #3
0
def main(args):
    table_path = load_yaml('config/global.yml', key='path')['tables']

    df = find_best_hyperparameters(table_path + args.problem, 'NDCG')

    R_train = load_numpy(path=args.path, name=args.train)
    R_valid = load_numpy(path=args.path, name=args.valid)
    R_test = load_numpy(path=args.path, name=args.test)

    R_train = R_train + R_valid

    topK = [5, 10, 15, 20, 50]

    frame = []
    for idx, row in df.iterrows():
        start = timeit.default_timer()
        row = row.to_dict()
        row['metric'] = ['R-Precision', 'NDCG', 'Precision', 'Recall', "MAP"]
        row['topK'] = topK
        result = execute(R_train,
                         R_test,
                         row,
                         models[row['model']],
                         gpu_on=args.gpu)
        stop = timeit.default_timer()
        print('Time: ', stop - start)
        frame.append(result)

    results = pd.concat(frame)
    save_dataframe_csv(results, table_path, args.name)
Beispiel #4
0
def main(args):
    progress = WorkSplitter()

    table_path = 'tables/'

    test = load_numpy(path=args.path, name=args.dataset + args.test)

    df = pd.DataFrame({
        'model': [
            'RestrictedBatchSampleMF', 'RestrictedBatchSampleMF',
            'RestrictedBatchSampleMF', 'RestrictedBatchSampleMF',
            'RestrictedBatchSampleMF'
        ],
        'way': [None, 'head_users', 'tail_users', 'head_items', 'tail_items']
    })

    progress.subsection("Gain Analysis")
    frame = []
    for idx, row in df.iterrows():
        row = row.to_dict()
        row['metric'] = ['NLL', 'AUC']
        row['rank'] = 10
        result = execute(test, row, folder=args.model_folder + args.dataset)
        frame.append(result)

    results = pd.concat(frame)
    save_dataframe_csv(results, table_path, args.name)
Beispiel #5
0
def main(args):
    table_path = load_yaml('config/global.yml', key='path')['tables']

    df = find_best_hyperparameters(table_path+args.tuning_result_path, 'MAP@10')

    R_train = load_numpy(path=args.path, name=args.train)
    R_valid = load_numpy(path=args.path, name=args.valid)
    R_test = load_numpy(path=args.path, name=args.test)

    R_train = R_train + R_valid

#    R_train[(R_train <= 3).nonzero()] = 0
#    R_test[(R_test <= 3).nonzero()] = 0

#    R_train[(R_train > 3).nonzero()] = 1
#    R_test[(R_test > 3).nonzero()] = 1
#    import ipdb; ipdb.set_trace()

    topK = [5, 10, 15, 20, 50]

    frame = []
    for idx, row in df.iterrows():
        start = timeit.default_timer()
        row = row.to_dict()
        row['metric'] = ['R-Precision', 'NDCG', 'Precision', 'Recall', "MAP"]
        row['topK'] = topK
        result = execute(R_train, R_test, row, models[row['model']])
        stop = timeit.default_timer()
        print('Time: ', stop - start)
        frame.append(result)

    results = pd.concat(frame)
    save_dataframe_csv(results, table_path, args.name)