cls[sr] = {} cl = result0[i][sr] cls[sr][userlist[i]['username']] = cl pairings = [(sr1, u, sr2) for sr1 in args.subreddits for u in userlist for sr2 in args.subreddits] pool = multiprocessing.Pool(multiprocessing.cpu_count()) print('Testing classifiers') result1 = pool.map(test_classifiers, pairings) pool.close() pool.join() boxplot_data = {} for i in range(0, len(pairings)): pairing = pairings[i] res = result1[i] sr1, u, sr2 = pairing username = u['username'] if username not in boxplot_data: boxplot_data[username] = {} rr = '%s %s' % (sr1, sr2) boxplot_data[username][rr] = res for u in boxplot_data: boxplot = boxplot_data[u] graph.boxplot_single('data/boxplot_%s' % u, boxplot, None, (0, len(userlist)), 'trained reddit-tested reddit', 'mean rank' 'Box plot for mean rank for %s' % u)
# for sr2 in args.subreddits ] pairings = [ (train_user['username'], test_user) for train_user in userlist for test_user in corpora_users] pool = multiprocessing.Pool(multiprocessing.cpu_count()) print('Testing classifiers') result1 = pool.map(test_classifiers, pairings) pool.close() pool.join() boxplot_data = {} for i in range(0, len(pairings)): pairing = pairings[i] res = result1[i] if res is None: continue u1, u2 = pairing if u1 not in boxplot_data: boxplot_data[u1] = {} boxplot_data[u1][u2] = res for u in boxplot_data: boxplot = boxplot_data[u] graph.boxplot_single('data/boxplot_%s' % u, boxplot, None, (0, len(userlist)), 'tested user', 'mean rank' 'Box plot for mean rank for %s from worldnews to gaming' % u)
for sr1 in args.subreddits for u in userlist for sr2 in args.subreddits ] pool = multiprocessing.Pool(multiprocessing.cpu_count()) print('Testing classifiers') result1 = pool.map(test_classifiers, pairings) pool.close() pool.join() boxplot_data = {} for i in range(0, len(pairings)): pairing = pairings[i] res = result1[i] sr1, u, sr2 = pairing username = u['username'] if username not in boxplot_data: boxplot_data[username] = {} rr = '%s %s' % (sr1, sr2) boxplot_data[username][rr] = res for u in boxplot_data: boxplot = boxplot_data[u] graph.boxplot_single('data/boxplot_%s' % u, boxplot, None, (0, len(userlist)), 'trained reddit-tested reddit', 'mean rank' 'Box plot for mean rank for %s' % u)
# for sr1 in args.subreddits # for u in corpora_users # for sr2 in args.subreddits ] pairings = [(train_user['username'], test_user) for train_user in userlist for test_user in corpora_users] pool = multiprocessing.Pool(multiprocessing.cpu_count()) print('Testing classifiers') result1 = pool.map(test_classifiers, pairings) pool.close() pool.join() boxplot_data = {} for i in range(0, len(pairings)): pairing = pairings[i] res = result1[i] if res is None: continue u1, u2 = pairing if u1 not in boxplot_data: boxplot_data[u1] = {} boxplot_data[u1][u2] = res for u in boxplot_data: boxplot = boxplot_data[u] graph.boxplot_single( 'data/boxplot_%s' % u, boxplot, None, (0, len(userlist)), 'tested user', 'mean rank' 'Box plot for mean rank for %s from worldnews to gaming' % u)
pairings = [(sr1, u, sr2) for sr1 in args.subreddits for u in userlist for sr2 in args.subreddits] pool = multiprocessing.Pool(multiprocessing.cpu_count()) print("Testing classifiers") result1 = pool.map(test_classifiers, pairings) pool.close() pool.join() boxplot_data = {} for i in range(0, len(pairings)): pairing = pairings[i] res = result1[i] sr1, u, sr2 = pairing username = u["username"] if username not in boxplot_data: boxplot_data[username] = {} rr = "%s %s" % (sr1, sr2) boxplot_data[username][rr] = res for u in boxplot_data: boxplot = boxplot_data[u] graph.boxplot_single( "data/boxplot_%s" % u, boxplot, None, (0, len(userlist)), "trained reddit-tested reddit", "mean rank" "Box plot for mean rank for %s" % u, )