Пример #1
0
    def draw_topK(search_type=0, bar_type=0):
        # testSampleResultFile.t=0.ns=500.r=1.k=10.nw=1
        alg_type = ['SPBase', 'SPBest']
        ns = 200
        radius = 2
        ks = [1, 3, 5, 8, 10, 15, 20]
        nw = 5

        if bar_type==0:
            ys = [i*1000 for i in range(13)]
            ys = None
            y_label = 'Runtime (ms)'
        elif bar_type==1:
            ys = [i*100 for i in range(5)]
            y_label = '# of TQSP Computations'
        else:
            ys = [i*10 for i in range(6)]
            y_label = '# of R-tree nodes accessed'

        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\k_nw\\'

        if bar_type==0:
            timeBar = Bar(xLabel=r'top-$k$', yLabel=y_label, is_stack=True, title=r'top-k type=' + str(search_type), ys=ys)
            for i in range(len(alg_type)):
                datas = []
                for k in ks:
                    data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_type[i], nwlen=1000000, mds=1000, t=search_type, ns=200, r=2, k=k, nw=5, wf=500, dr=7))
                    print(data)
                    datas.append(data)
                timeOthers = []
                timeSemantics = []
                for data in datas:
                    timeSemantics.append(data.timeSemantic)
                    timeOthers.append(data.timeOther)

                timeBar.draw_bar(i, timeSemantics, hatch=Bar.hatchx, label=alg_type[i])
                timeBar.draw_bar(i, timeOthers, ys=timeSemantics, faceColor='white')
            timeBar.show()
        else:
            if 1==bar_type: y_type = 'TQSP'
            elif 2==bar_type: y_type = 'RTree'
            bar = Bar(xLabel=r'top-$k$', yLabel=y_label, title=r'top-k type=' + str(search_type), ys=ys, y_type=y_type)
            for i in range(len(alg_type)):
                datas = []
                for k in ks:
                    data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_type[i], nwlen=1000000, mds=1000, t=search_type, ns=200, r=2, k=k, nw=5, wf=500, dr=7))
                    print(data)
                    datas.append(data)
                list1 = []
                for data in datas:
                    if 1==bar_type:
                        list1.append(data.numTQSP)
                    elif 2==bar_type:
                        list1.append(data.numAccessedRTreeNode)
                bar.draw_bar(i, list1, label=alg_type[i])
            bar.show()
Пример #2
0
    def draw_date_range(label=r'$|q.\delta|$', base_y=None, x_rotation=0, fpath='test.pdf'):
        if base_y!=None: ys = [base_y+i*100 for i in range(0, 17)]
        # x_txts = [r'$5\times10^8$', r'$1\times10^8$', r'$5\times10^7$', r'$1\times10^7$',
        #           r'$5\times10^6$', r'$1\times10^6$', r'$5\times10^5$', r'$1\times10^5$',
        #           r'$1\times10^4$', '0']
        # x_txts = [0,3,7,15,30,50,100,150,300,600]
        # drs = [0,3,7,15,30,50,100,150,300,600]
        drs = [0,3,7,15,30,50,100,150]
        x_txts = [0,6,14,30,60,100,200,300]
        xs=[i for  i in  range(len(drs))]

        if base_y!=None: chart = LineChart(xs, x_txts, ys=ys, yscale='liner', xLabel=label, title=label, yLabel='Runtime (ms)', xlabel_rotation=x_rotation, fpath = fpath)
        else:   chart = LineChart(xs, x_txts, xLabel=label, title=label, yLabel='Runtime (ms)', xlabel_rotation=x_rotation, fpath=fpath)

        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\dr\\'
        alg_types=['SPBase', 'SPBest']
        for alg_type in alg_types:
            runtimes = []
            for dr in drs:
                data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_type, nwlen=1000000, mds=1000, t=1, ns=200, r=2, k=5, nw=5, wf=500, dr=dr))
                # print(data)
                runtimes.append(data.timeTotal)
            print(runtimes)
            if alg_type=='SPBase':
                chart.draw_line(runtimes, r'$SPTR$')
            elif alg_type=='SPBest':
                chart.draw_line(runtimes, r'$SPTR^*$')
        chart.show()
Пример #3
0
    def draw_n_words(search_type=0):
        # testSampleResultFile.t=0.ns=500.r=1.k=10.nw=1
        xs = [0.5, 1, 2, 3, 4, 5, 5.5]
        x_txts = [1.0, 3.0, 5.0, 8.0, 10.0]
        ys = [i*100 for i in range(15)]
        alg_type = ['SPBase', 'SPBest']
        ns = 200
        radius = 2
        k = 5
        nws = [1, 3, 5, 8, 10]

        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\k_nw\\'

        timeBar = Bar(xLabel=r'|$q.\psi$|', yLabel='Runtime (ms)', is_stack=True, title='n_wrods type=' + str(search_type), ys=ys, xs=xs, x_txts=x_txts, y_type='NW')
        for i in range(len(alg_type)):
            datas = []
            for nw in nws:
                data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_type[i], nwlen=1000000, mds=1000, t=search_type, ns=200, r=2, k=5, nw=nw, wf=500, dr=7))
                print(data)
                datas.append(data)
            timeOthers = []
            timeSemantics = []
            for data in datas:
                timeSemantics.append(data.timeSemantic)
                timeOthers.append(data.timeOther)
            timeBar.draw_bar(i, timeSemantics, hatch=Bar.hatchx, label=alg_type[i])
            timeBar.draw_bar(i, timeOthers, ys=timeSemantics, faceColor='white')
        timeBar.show()
Пример #4
0
    def draw_differ_size(line_type=0, title='Graph Vertex Size (in million)', fpath='test.pdf'):
        # testSampleResultFile.t=0.ns=500.r=1.k=10.nw=1
        xs = [1, 2, 3, 4]
        x_txts = [2.0, 4.0, 6.0, 8.0]

        if line_type==0:    yLabel='Runtime (ms)'
        elif line_type==1:  yLabel = '# of R-tree nodes accessed'

        chart = LineChart(xs, x_txts, xLabel=r'Graph Vertex Size (in million)', yLabel=yLabel, title=title, fpath=fpath)

        alg_types = ['SPBase', 'SPBest']
        ts = [0, 1]
        sizes = ['2000000', '4000000', '6000000', 'org']
        alg_names = [r'$SPTD$', r'$SPTR$', r'$SPTD^*$', r'$SPTR^*$']
        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\diff_size\\'

        alg_names_index = 0
        for alg_type in alg_types:
            for t in ts:
                runtimes = []
                for i in range(len(sizes)):
                    data = Data.getData(fp=PathUtility.sample_res_path(base_dir + sizes[i] + '\\', sp=alg_type, nwlen=1000000, mds=1000, t=t, ns=200, r=2, k=5, nw=5, wf=500, dr=7))
                    print(data)
                    if line_type==0:    runtimes.append(data.timeTotal)
                    elif line_type==1:  runtimes.append(data.numAccessedRTreeNode)
                chart.draw_line(runtimes, label=alg_names[alg_names_index])
                alg_names_index = alg_names_index + 1
        chart.show()
Пример #5
0
    def draw_nw(base_y=None, fpath='test.pdf'):
        ys = None
        if base_y != None:
            ys = [base_y+i*100 for i in range(0, 11)]
        x_txts = [1.0, 3.0, 5.0, 8.0, 10.0]
        xs=[i for  i in  range(len(x_txts))]

        yLabel = 'Runtime (ms)'

        chart = LineChart(xs, x_txts, ys=ys, xLabel=r'|$q.\psi$|', yLabel=yLabel, title=r'|$q.\psi$|', fpath=fpath)

        alg_types = ['SPBase', 'SPBest']
        search_types = [0, 1]
        type = None

        nws = [1, 3, 5, 8, 10]
        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\k_nw\\'
        for search_index in range(len(search_types)):
            for alg_index in range(len(alg_types)):
                if alg_index==0:
                    if search_index==0: type=r'$SPTD$'
                    else:   type=r'$SPTR$'
                else:
                    if search_index==0: type=r'$SPTD^*$'
                    else:   type=r'$SPTR^*$'
                runtimes = []
                for nw in nws:
                    data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_types[alg_index], nwlen=1000000, mds=1000, t=search_types[search_index], ns=200, r=2, k=5, nw=nw, wf=500, dr=7))
                    print(data)
                    runtimes.append(data.timeTotal)
                chart.draw_line(runtimes, type)
        chart.show()
Пример #6
0
    def oNword(fName='test.pdf', type=1):
        rFanout = 50
        alpha = 0.5
        steepD = 0.1
        h = 14
        om = 1
        oe = '1.0E-4'
        ns = 100

        t = 1
        ts = [11, 12]

        k = 10
        nw = 2
        nws = [1, 2, 3, 4]

        mpts = 50

        eps = '1.0E-4'
        xi = '1.0E-4'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv1']
        xlabel = 'number of keyword'
        xTxts = ['1', '2', '3', '4']
        if type == 1:
            ylabel = 'milliseconds'
            ys = [i * 500 for i in range(5)]
            # ylim=[10, 10000]
        elif type == 2:
            ylabel = 'number of range queries'
            ylim = [100, 100000]

        # 创建bar对象
        bar = Bar(len(ts),
                  xlabel=xlabel,
                  xTxts=xTxts,
                  ylabel=ylabel,
                  yscale='linear',
                  ys=ys,
                  fName=fName)

        dir = BasePathOptic + 'nword\\'

        for tIndex in range(len(ts)):
            total = []
            for nwIndex in range(len(nws)):
                data = Data.getData(dir, rFanout, alpha, steepD, h, om, oe, ns,
                                    ts[tIndex], k, nws[nwIndex], mpts, eps, xi,
                                    maxPNeiByte)
                print(data)
                if type == 1: total.append(data.timeTotal)
                elif type == 2: total.append(data.numRangeRtree)
            bar.drawBar(barlabels[tIndex], tIndex, total)

        bar.show()
Пример #7
0
    def dEpsilon(fName='test.pdf'):
        rFanout = 50
        alpha = 0.5
        steepD = 0.1
        h = 14
        om = 1
        oe = '0.001'
        ns = 100

        t = 1
        ts = [1, 2, 3, 4]

        k = 10
        nw = 2

        mpts = 50

        eps = '0.001'
        epss = ['1.0E-4', '5.0E-4', '0.001', '0.005', '0.01']

        xi = '0.001'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv1', 'Adv2', 'Adv3']
        xlabel = '$\epsilon$'
        xTxts = ['0.0001', '0.0005', '0.001', '0.005', '0.01']
        ylabel = 'milliseconds'

        # 创建bar对象
        bar = Bar(4,
                  xlabel=xlabel,
                  xTxts=xTxts,
                  xRotateAngle=90,
                  ylabel=ylabel,
                  yscale='log',
                  ylim=[1000, 1000000],
                  loc=2,
                  fName=fName)

        dir = BasePathDbscan + 'nw_eps_mpt\\'

        for tIndex in range(len(ts)):
            timeTotals = []
            for epsIndex in range(len(epss)):
                data = Data.getData(dir, rFanout, alpha, steepD, h, om, oe, ns,
                                    ts[tIndex], k, nw, mpts, epss[epsIndex],
                                    xi, maxPNeiByte)
                print(data)
                timeTotals.append(data.timeTotal)
            bar.drawBar(barlabels[tIndex], tIndex, timeTotals)

        bar.show()
Пример #8
0
    def dMinpts(fName='test.pdf'):
        rFanout = 50
        alpha = 0.5
        steepD = 0.1
        h = 14
        om = 1
        oe = '0.001'
        ns = 100

        t = 1
        ts = [1, 2, 3, 4]

        k = 10
        nw = 2

        mpts = 5
        mptss = [10, 20, 50, 100, 200]

        eps = '0.001'
        xi = '0.001'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv1', 'Adv2', 'Adv3']
        xlabel = 'minpts'
        xTxts = ['10', '20', '50', '100', '200']
        ylabel = 'milliseconds'

        # 创建bar对象
        bar = Bar(4,
                  xlabel=xlabel,
                  xTxts=xTxts,
                  ylabel=ylabel,
                  yscale='log',
                  ylim=[1000, 100000],
                  fName=fName)

        dir = BasePathDbscan + 'nw_eps_mpt\\'

        for tIndex in range(len(ts)):
            timeTotals = []
            for mptIndex in range(len(mptss)):
                data = Data.getData(dir, rFanout, alpha, steepD, h, om, oe, ns,
                                    ts[tIndex], k, nw, mptss[mptIndex], eps,
                                    xi, maxPNeiByte)
                print(data)
                timeTotals.append(data.timeTotal)
            bar.drawBar(barlabels[tIndex], tIndex, timeTotals)

        bar.show()
Пример #9
0
    def draw_radius(type=0, base_y=600, title='TEST', fpath='test.pdf'):
        ys = [base_y+i*50 for i in range(0, 11)]
        xs=[i for  i in  range(0, 4)]
        x_txts = [1.0, 2.0, 3.0, 5.0]
        chart = LineChart(xs, x_txts, ys=ys, yscale='liner', xLabel=r'$\alpha$-radius', yLabel='Runtime (ms)', title=title, fpath=fpath)
        # chart = LineChart(xs, x_txts, xLabel=r'$\alpha$-radius', yLabel='Runtime (ms)')

        radius = [1, 2, 3, 5]
        ks = [1, 3, 5, 8, 10, 15, 20]
        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\radius_k\\'
        for k in ks:
            runtimes = []
            for r in radius:
                data = Data.getData(fp=PathUtility.sample_res_path(base_dir, nwlen=1000000, mds=1000, t=type, ns=200, r=r, k=k, nw=5, wf=500, dr=7))
                print(data)
                runtimes.append(data.timeTotal)
            chart.draw_line(runtimes, 'k=' + str(k))
        chart.show()
Пример #10
0
    def draw_k(show_type, base_y=None, fpath='test.pdf'):
        ys = None
        ys = [i*100 for i in range(17)]
        if base_y != None:
            ys = [base_y+i*100 for i in range(0, 17)]
        x_txts = [1.0, 3.0, 5.0, 8.0, 10.0, 15.0, 20.0]
        xs=[i for  i in  range(len(x_txts))]

        yLabel = None
        yscale = 'liner'
        if 0==show_type:
            yLabel = 'Runtime (ms)'
        elif 1==show_type:
            yLabel = '# of TQTSP Computations'
            yscale='log'
        elif 2==show_type: yLabel = '# of R-tree nodes accessed'

        chart = LineChart(xs, x_txts, ys=ys, yscale=yscale, xLabel=r'top-$k$', yLabel=yLabel, title=r'top-$k$', fpath=fpath)

        alg_types = ['SPBase', 'SPBest']
        search_types = [0, 1]
        type = None

        ks = [1, 3, 5, 8, 10, 15, 20]
        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\k_nw\\'
        for search_index in range(len(search_types)):
            for alg_index in range(len(alg_types)):
                if alg_index==0:
                    if search_index==0: type=r'$SPTD$'
                    else:   type=r'$SPTR$'
                else:
                    if search_index==0: type=r'$SPTD^*$'
                    else:   type=r'$SPTR^*$'
                runtimes = []
                for k in ks:
                    data = Data.getData(fp=PathUtility.sample_res_path(base_dir, sp=alg_types[alg_index], nwlen=1000000, mds=1000, t=search_types[search_index], ns=200, r=2, k=k, nw=5, wf=500, dr=7))
                    print(data)
                    if 0==show_type: runtimes.append(data.timeTotal)
                    elif 1==show_type: runtimes.append(data.numTQSP)
                    elif 2==show_type: runtimes.append(data.numAccessedRTreeNode)
                chart.draw_line(runtimes, type)
        chart.show()
Пример #11
0
    def draw_max_date(nwlen=1000000, label='MAX_DATE_DIFFERENCE', base_y=None, x_rotation=0, fpath='test.pdf'):
        if base_y!=None: ys = [base_y+i*50 for i in range(0, 11)]
        xs=[i for  i in  range(0, 9)]
        x_txts = [r'$2.1\times10^8$', r'$5\times10^3$', r'$2.5\times10^3$', r'$1\times10^3$',
                  r'$7.5\times10^2$', r'$5\times10^2$', r'$2.5\times10^2$', r'$1\times10^2$',
                  r'$1$']
        maxDates = [210000000, 5000, 2500, 1000, 750, 500, 250, 100, 1]
        if base_y!=None: chart = LineChart(xs, x_txts, ys=ys, yscale='liner', xLabel=label, yLabel='Runtime (ms)', title=label, xlabel_rotation=x_rotation, fpath = fpath)
        else: chart = LineChart(xs, x_txts, xLabel=label, yLabel='Runtime (ms)', title=label, xlabel_rotation=x_rotation, fpath = fpath)

        chart.ax.grid('on')

        types=[0, 1]
        for type in types:
            runtimes = []
            for maxDate in maxDates:
                data = Data.getData(type, 200, 3, 5, 5, relativePath='nw=10\\MAX_DATE', f_nwlen=nwlen, f_mds=maxDate)
                runtimes.append(data.timeTotal)
            if type==0:
                chart.draw_line(runtimes, r'$SPTD^*$')
            elif type==1:
                chart.draw_line(runtimes, r'$SPTR^*$')
        chart.show()
Пример #12
0
    def draw_max_pn(label="l", base_y=None, x_rotation=0, fpath='test.pdf'):
        if base_y!=None: ys = [base_y+i*100 for i in range(0, 17)]
        xs=[i for  i in  range(0, 10)]
        lens = [500000000, 100000000, 50000000, 10000000, 5000000, 1000000, 500000, 100000, 10000, 0]
        x_txts = [r'$5\times10^8$', r'$1\times10^8$', r'$5\times10^7$', r'$1\times10^7$',
                  r'$5\times10^6$', r'$1\times10^6$', r'$5\times10^5$', r'$1\times10^5$',
                  r'$1\times10^4$', '0']

        if base_y!=None: chart = LineChart(xs, x_txts, ys=ys, yscale='liner', xLabel=label, title=label, yLabel='Runtime (ms)', xlabel_rotation=x_rotation, fpath = fpath)
        else:   chart = LineChart(xs, x_txts, xLabel=label, title=label, yLabel='Runtime (ms)', xlabel_rotation=x_rotation, fpath=fpath)

        types=[0, 1]
        for type in types:
            runtimes = []
            for nwlen in lens:
                data = Data.getData(type, 200, 3, 5, 5, f_nwlen=nwlen, relativePath='yago2s_single_date\\pn_len')
                runtimes.append(data.timeTotal)
            if type==0:
                chart.draw_line(runtimes, r'$SPTD^*$')
            elif type==1:
                chart.draw_line(runtimes, r'$SPTR^*$')
        chart.ax.grid('on')
        chart.show()
Пример #13
0
    def draw_word_frequency(title='WORD_FREQUENCY', base_y=None, rotation=0, fpath='test.pdf'):
        if base_y!=None: ys = [base_y+i*100 for i in range(0, 14)]
        xs=[i for  i in  range(0, 10)]
        x_txts = [0, r'$5\times10^1$', r'$1\times10^2$',
                     r'$5\times10^2$', r'$1\times10^3$',
                     r'$5\times10^3$', r'$1\times10^4$',
                     r'$5\times10^4$', r'$1\times10^5$',
                     r'$1\times10^6$'
                 ]
        if base_y!=None: chart = LineChart(xs, x_txts, ys=ys, yscale='liner', xLabel=title, yLabel='Runtime (ms)', title=title, xlabel_rotation=rotation, fpath = fpath)
        else: chart = LineChart(xs, x_txts, xLabel=title, yLabel='Runtime (ms)', title=title, xlabel_rotation=rotation, fpath = fpath)

        # chart.ax.grid('on')

        wfs = [0, 50, 100, 500, 1000, 5000, 10000, 50000, 100000, 1000000]

        base_dir = 'D:\\nowMask\KnowledgeBase\\sample_result\\yago2s_single_date\\word_fequency_test\\'
        runtimes = []
        for wf in wfs:
            data = Data.getData(fp=PathUtility.sample_res_path(base_dir, wf=wf))
            runtimes.append(data.timeTotal)
        chart.draw_line(runtimes, r'$SPTD^*$')
        chart.show()
Пример #14
0
    def oDiffScale(fName='test.pdf'):
        rFanout = 100
        alpha = 0.5
        steepD = 0.1

        h = 12

        om = 1
        oe = '0.001'
        ns = 200

        t = 1
        ts = [11, 12]

        k = 10
        nw = 2

        mpts = 20

        eps = '0.001'
        xi = '0.001'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv']
        xlabel = 'data set size (in million)'
        ylabel = 'seconds'

        scaleTxts = ['0.5', '1.0', '1.5', '2.0']

        # 创建bar对象
        numBar = 2
        # bar = Bar(numBar,
        #           xlabel=xlabel, xTxts=scaleTxts,
        #           ylabel=ylabel, yscale='log', ylim=[100, 100000],
        #           fName = fName, xRotateAngle='0')
        bar = Bar(numBar,
                  loc=2,
                  xlabel=xlabel,
                  xTxts=scaleTxts,
                  ylabel=ylabel,
                  yscale='linear',
                  ys=[i * 5 for i in range(5)],
                  fName=fName,
                  xRotateAngle='0')

        dir = BasePathOptic + 'diff_scale\\'

        # indexs = Data.indexs(dir, rFanout, alpha, steepD, 14, om, oe, ns, 4,
        #                             k, nw, mpts, eps, xi, maxPNeiByte, numMinCluster=k)

        scalePaths = ['50\\', '100\\', '150\\', '200\\']

        for tIndex in range(len(ts)):
            timeTotals = []
            for scalePathIndex in range(len(scalePaths)):
                data = Data.getData(dir + scalePaths[scalePathIndex],
                                    rFanout,
                                    alpha,
                                    steepD,
                                    str(h),
                                    om,
                                    oe,
                                    ns,
                                    ts[tIndex],
                                    k,
                                    nw,
                                    mpts,
                                    eps,
                                    xi,
                                    maxPNeiByte,
                                    numMinCluster=k)
                # data = Data.getDataByIndexs(dir, rFanout, alpha, steepD, hs[hIndex], om, oe, ns, ts[tIndex],
                #                     k, nw, mpts, eps, xi, indexs=indexs)
                print(data)
                timeTotals.append(data.timeTotal / 1000)
            bar.drawBar(barlabels[tIndex], tIndex, timeTotals)

        bar.show()
Пример #15
0
    def oK(fName='test.pdf'):
        rFanout = 100
        alpha = 0.5
        steepD = 0.1
        h = 12
        om = 1
        # oe='5.0E-4'
        oe = '0.001'
        ns = 200

        t = 1
        ts = [11, 12]

        k = 10
        ks = [5, 10, 15, 20]

        nw = 2

        mpts = 20

        eps = '0.001'
        xi = '0.001'
        # xi ='5.0E-4'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv']
        xlabel = 'k'
        xTxts = ['5', '10', '15', '20']
        ys = None
        ylabel = 'seconds'
        ys = [i * 5 for i in range(6)]
        # ylim=[10, 10000]
        yscale = 'linear'

        # 创建bar对象
        bar = Bar(len(ts),
                  xlabel=xlabel,
                  xTxts=xTxts,
                  ylabel=ylabel,
                  yscale=yscale,
                  ys=ys,
                  fName=fName)

        dir = BasePathOptic + 'k\\'

        indexs = Data.indexs(dir,
                             rFanout,
                             alpha,
                             steepD,
                             12,
                             om,
                             oe,
                             ns,
                             12,
                             k,
                             nw,
                             mpts,
                             eps,
                             xi,
                             maxPNeiByte,
                             numMinCluster=k)

        for tIndex in range(len(ts)):
            total = []
            for kIndex in range(len(ks)):
                # data = Data.getData(dir, rFanout, alpha, steepD, h, om, oe, ns, ts[tIndex],
                #                     ks[kIndex], nw, mpts, eps, xi, maxPNeiByte)
                data = Data.getDataByIndexs(dir,
                                            rFanout,
                                            alpha,
                                            steepD,
                                            h,
                                            om,
                                            oe,
                                            ns,
                                            ts[tIndex],
                                            ks[kIndex],
                                            nw,
                                            mpts,
                                            eps,
                                            xi,
                                            indexs=indexs)
                print(data)
                total.append(data.timeTotal / 1000)
            bar.drawBar(barlabels[tIndex], tIndex, total)

        bar.show()
Пример #16
0
    def oNword(fName='test.pdf', type=1):
        rFanout = 100
        alpha = 0.5
        steepD = 0.1
        h = 12
        om = 1
        # oe='5.0E-4'
        oe = '0.001'
        ns = 200

        t = 1
        ts = [11, 12]

        k = 10
        nw = 2
        nws = [1, 2, 3, 4]

        mpts = 20

        eps = '0.001'
        xi = '0.001'
        # xi ='5.0E-4'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv']
        xlabel = 'number of keyword'
        xTxts = ['1', '2', '3', '4']
        ys = None
        if type == 1:
            ylabel = 'seconds'
            ys = [i * 5 for i in range(6)]
            # ylim=[10, 10000]
            yscale = 'linear'
        elif type == 2:
            ylabel = 'number of range queries'
            ylim = [100, 100000]
            yscale = 'linear'

        # 创建bar对象
        bar = Bar(len(ts),
                  xlabel=xlabel,
                  xTxts=xTxts,
                  ylabel=ylabel,
                  yscale=yscale,
                  ys=ys,
                  fName=fName)

        dir = BasePathOptic + 'nw_01\\'

        # indexs = Data.indexs(dir, rFanout, alpha, steepD, 12, om, oe, ns, 12,
        #                             k, nw, mpts, eps, xi, maxPNeiByte, numMinCluster=k)

        for tIndex in range(len(ts)):
            total = []
            for nwIndex in range(len(nws)):
                data = Data.getData(dir,
                                    rFanout,
                                    alpha,
                                    steepD,
                                    h,
                                    om,
                                    oe,
                                    ns,
                                    ts[tIndex],
                                    k,
                                    nws[nwIndex],
                                    mpts,
                                    eps,
                                    xi,
                                    maxPNeiByte,
                                    numMinCluster=k)
                # data = Data.getDataByIndexs(dir, rFanout, alpha, steepD, h, om, oe, ns, ts[tIndex],
                #                     k, nws[nwIndex], mpts, eps, xi, indexs=indexs)
                print(data)
                if type == 1: total.append(data.timeTotal / 1000)
                elif type == 2: total.append(data.numRangeRtree)
            bar.drawBar(barlabels[tIndex], tIndex, total)

        bar.show()
Пример #17
0
    def dHAll(fName='test.pdf', isAll=False):
        rFanout = 100
        alpha = 0.5
        steepD = 0.1

        h = 15
        # hs = ['4', '6', '8', '10', '12', '14', '16']
        hs = ['6', '8', '10', '12', '14', '16']

        om = 1
        oe = '0.001'
        ns = 200

        t = 1
        ts = None
        if isAll: ts = [1, 2, 3, 4]
        else: ts = [1, 4]

        k = 10
        nw = 2

        mpts = 20

        eps = '0.001'
        xi = '0.001'
        maxPNeiByte = 2147483631

        # 设置bar参数
        if isAll:
            barlabels = ['Basic', 'Adv1', 'Adv2', 'Adv3']
        else:
            barlabels = ['Basic', 'Adv3']
        xlabel = 'h'
        ylabel = 'milliseconds'

        # 创建bar对象
        numBar = 2
        if isAll: numBar = 4
        if isAll:
            bar = Bar(numBar,
                      widthBar=0.1,
                      spanBars=0.02,
                      xlabel=xlabel,
                      xTxts=hs,
                      ylabel=ylabel,
                      yscale='log',
                      ylim=[1000, 100000],
                      fName=fName)
        else:
            bar = Bar(numBar,
                      xlabel=xlabel,
                      xTxts=hs,
                      ylabel=ylabel,
                      yscale='log',
                      ylim=[1000, 100000],
                      fName=fName)

        dir = BasePathDbscan + 'h_all02\\'

        indexs = Data.indexs(dir,
                             rFanout,
                             alpha,
                             steepD,
                             14,
                             om,
                             oe,
                             ns,
                             4,
                             k,
                             nw,
                             mpts,
                             eps,
                             xi,
                             maxPNeiByte,
                             numMinCluster=k)

        for tIndex in range(len(ts)):
            timeTotals = []
            for hIndex in range(len(hs)):
                # data = Data.getData(dir, rFanout, alpha, steepD, hs[hIndex], om, oe, ns, ts[tIndex],
                #                     k, nw, mpts, eps, xi, maxPNeiByte, numMinCluster=k)
                data = Data.getDataByIndexs(dir,
                                            rFanout,
                                            alpha,
                                            steepD,
                                            hs[hIndex],
                                            om,
                                            oe,
                                            ns,
                                            ts[tIndex],
                                            k,
                                            nw,
                                            mpts,
                                            eps,
                                            xi,
                                            indexs=indexs)
                print(data)
                timeTotals.append(data.timeTotal)
            bar.drawBar(barlabels[tIndex], tIndex, timeTotals)

        bar.show()
Пример #18
0
    def dNword(fName='test.pdf', type=1):
        rFanout = 100
        alpha = 0.5
        steepD = 0.1
        h = 12
        om = 1
        oe = '0.001'
        ns = 200

        t = 1
        ts = [1, 2, 3, 4]

        k = 10
        nw = 2
        nws = [1, 2, 3, 4]

        mpts = 20

        eps = '0.001'
        xi = '0.001'
        maxPNeiByte = 2147483631

        # 设置bar参数
        barlabels = ['Basic', 'Adv1', 'Adv2', 'Adv3']
        xlabel = 'number of keyword'
        xTxts = ['1', '2', '3', '4']
        if type == 1:
            ylabel = 'milliseconds'
            ylim = [100, 100000]
        elif type == 2:
            ylabel = 'number of range queries'
            ylim = [1000, 100000]

        # 创建bar对象
        bar = Bar(4,
                  xlabel=xlabel,
                  xTxts=xTxts,
                  ylabel=ylabel,
                  yscale='log',
                  ylim=ylim,
                  fName=fName)

        dir = BasePathDbscan + 'nw_mpts\\'

        for tIndex in range(len(ts)):
            total = []
            for nwIndex in range(len(nws)):
                data = Data.getData(dir,
                                    rFanout,
                                    alpha,
                                    steepD,
                                    h,
                                    om,
                                    oe,
                                    ns,
                                    ts[tIndex],
                                    k,
                                    nws[nwIndex],
                                    mpts,
                                    eps,
                                    xi,
                                    maxPNeiByte,
                                    numMinCluster=k)
                print(data)
                if type == 1: total.append(data.timeTotal)
                elif type == 2: total.append(data.numRangeRtree)
            bar.drawBar(barlabels[tIndex], tIndex, total)

        bar.show()
Пример #19
0
    def draw_differ_size(search_type=0, bar_type=0):
        # testSampleResultFile.t=0.ns=500.r=1.k=10.nw=1
        xs = [0.5, 1, 2, 3, 4, 4.5]
        x_txts = [2.0, 4.0, 6.0, 8.0]

        alg_type = ['SPBase', 'SPBest']
        ns = 200
        radius = 2
        sizes = [2, 4, 6, 8]
        nw = 5
        k = 5

        if bar_type==0:
            ys = [i*1000 for i in range(13)]
            ys = None
            y_label = 'Runtime (ms)'
        elif bar_type==1:
            ys = [i*100 for i in range(5)]
            y_label = '# of TQSP Computations'
        else:
            ys = [i*10 for i in range(6)]
            y_label = '# of R-tree nodes accessed'

        if bar_type==0:
            timeBar = Bar(xLabel='Graph Vertex Size (in million)', yLabel=y_label, is_stack=True, title='Graph Vertex Size type=' + str(search_type), ys=ys, xs=xs, x_txts=x_txts)
            for i in range(len(alg_type)):
                datas = []
                for size in sizes:
                    dir_name = 'sample_result';
                    if size!=8:   dir_name = dir_name + '_' + str(int(size) * 1000000)
                    dir_name = dir_name + '\\'
                    data = Data.getData(search_type, ns, radius, k, nw, relativePath='nw=10\\differ_size\\' + dir_name, prefix=alg_type[i]+'.nwlen=1000000.mds=1000')
                    print(data)
                    datas.append(data)
                timeOthers = []
                timeSemantics = []
                for data in datas:
                    timeSemantics.append(data.timeSemantic)
                    timeOthers.append(data.timeOther)

                timeBar.draw_bar(i, timeSemantics, hatch=Bar.hatchx, label=alg_type[i])
                timeBar.draw_bar(i, timeOthers, ys=timeSemantics, faceColor='white')
            timeBar.show()
        else:
            if 1==bar_type: y_type = 'TQSP'
            elif 2==bar_type: y_type = 'RTree'
            bar = Bar(xLabel='Graph Vertex Size (in million)', yLabel=y_label, title='Graph Vertex Size type=' + str(search_type), ys=ys, y_type=y_type, xs=xs, x_txts=x_txts)
            for i in range(len(alg_type)):
                datas = []
                for size in sizes:
                    dir_name = 'sample_result';
                    if size!=8:   dir_name = dir_name + '_' + str(int(size) * 1000000)
                    dir_name = dir_name + '\\'
                    data = Data.getData(search_type, ns, radius, k, nw, relativePath='nw=10\\differ_size\\' + dir_name, prefix=alg_type[i]+'.nwlen=1000000.mds=1000')
                    print(data)
                    datas.append(data)
                list1 = []
                for data in datas:
                    if 1==bar_type:
                        list1.append(data.numTQSP)
                    elif 2==bar_type:
                        list1.append(data.numAccessedRTreeNode)
                bar.draw_bar(i, list1, label=alg_type[i])
            bar.show()