colors = ['r-', 'b--.', 'k-.', 'g:'] sys = 'sybilframe' plt.figure(figsize=(3.5, 2.3)) plt.ylim(0, 1.1) plt.suptitle('Sybilframe Edge Prior Influence - ' + str.upper(str(graph)[0]) + str(graph)[1:], weight='bold') for enu, i in enumerate((0.1, 0.3, 0.6, 0.82)): perTarAll = pickle.load( open( '../pickles/sybilEdgeProb/sybilEdgeProb{}PTar{}.p'.format( i, graph), 'rb')) perTar = perTarAll[0] perTarAUC = getMergedAuc(perTar) print(perTarAUC) paras = perTarAll[1] x = [x for x in (1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50)] print(x) print(list(perTarAUC['sybilframe'].values())) plt.plot(x, list(perTarAUC['sybilframe'].values()), colors[enu], label='FN = ' + str(i)) if graph == 'facebook': plt.legend(loc='lower right') plt.tight_layout()
f, axarr = plt.subplots(1, 4, figsize=(7.5, 2.3), sharey=True) f.suptitle('Sybilframe Edge Prior Influence - ' +str.upper(str(graph)[0])+str(graph)[1:], weight='bold') for enu, i in enumerate((0.1, 0.3, 0.6, 0.82)): perTarAll = pickle.load(open('../pickles/sybilEdgeProb/sybilEdgeProb{}PTar{}.p'.format(i, graph), 'rb')) perTar = perTarAll[0] paras = perTarAll[1] ranksPerTar = getMergedRanks(perTar) """ plot random per""" x_h = sorted(ranksPerTar[sys][0][:-(paras.numSybils)]) x_s = sorted(ranksPerTar[sys][0][-(paras.numSybils):]) perTarAuc = getMergedAuc(perTar) print(list(perTarAuc['sybilframe'].values())) scaler = prep.MinMaxScaler() scaler.fit(sorted(ranksPerTar[sys][0])) x_h = scaler.transform(x_h) x_s = scaler.transform(x_s) y_h = get_cdf(x_h) y_s = get_cdf(x_s) ind_row = lambda enu: 0 if enu in (0,1) else 1 ind_col = lambda enu: 0 if enu in (0, 2) else 1
from util.calc import getMergedAuc import pickle from matplotlib import pyplot as plt from util import setMatplotlibPaper graph = 'slashdot' PRandAll = pickle.load( open('../pickles/attackEdges/attackEdgesPRand{}.p'.format(graph), 'rb')) PRandRes = PRandAll[0] PRandAUC = getMergedAuc(PRandRes) PRandParas = PRandAll[1] PTarAll = pickle.load( open('../pickles/attackEdges/attackEdgesPTar{}.p'.format(graph), 'rb')) PTarRes = PTarAll[0] PTarAUC = getMergedAuc(PTarRes) PTarParas = PTarAll[1] SRRandAll = pickle.load( open('../pickles/attackEdges/attackEdgesSRRand{}.p'.format(graph), 'rb')) SRRandRes = SRRandAll[0] SRRandAUC = getMergedAuc(SRRandRes) SRRandParas = SRRandAll[1] PTarTwoPhaseAll = pickle.load( open('../pickles/attackEdges/attackEdgesPTwoPhase{}.p'.format(graph), 'rb')) PTarTwoPhaseRes = PTarTwoPhaseAll[0] PTarTwoPhaseAUC = getMergedAuc(PTarTwoPhaseRes) PTarTwoPhaseParas = PTarTwoPhaseAll[1]
for sys in ('integro', ): f, axarr = plt.subplots(1, 3) f.suptitle('Integro Victim Prior Influence - Peripheral Random', fontsize=14, weight='bold') for enu, i in enumerate((0.1, 0.2, 0.4)): print(" ### FP is {} ###".format(i)) SRall = pickle.load( open('../pickles/victimProb/victimProb{}SRTar.p'.format(i), 'rb')) Pall = pickle.load( open('../pickles/victimProb/victimProb{}PTar.p'.format(i), 'rb')) pRes = Pall[0] pResAUC = getMergedAuc(pRes) print(pResAUC) print('auc peripheral') print(list(pResAUC['integro'].values())) parasP = Pall[1] SrRes = SRall[0] SrResAUC = getMergedAuc(SrRes) print('auc SR') print(list(SrResAUC['integro'].values())) parasSR = SRall[1] """ x_h = sorted(ranksPerTar[sys][0][:-(paras.numSybils)]) x_s = sorted(ranksPerTar[sys][0][-(paras.numSybils):])
import pickle from util.calc import get_cdf, getMergedRanks, getMergedAuc graph = 'slashdot' for i in (0.1, 0.2, 0.4): resSR = pickle.load( open('../pickles/victimProb/victimProb{}{}SRTar.p'.format(i, graph), 'rb'))[0] resP = pickle.load( open('../pickles/victimProb/victimProb{}{}PTar.p'.format(i, graph), 'rb'))[0] SRAuc = getMergedAuc(resSR) PAuc = getMergedAuc(resP) print(SRAuc['integro']) print(PAuc['integro']) print('')