Exemplo n.º 1
0
def query_plots(cur_i):
    """ Display the plots associated with the query experiment.

    :param cur_i: Cursor to database containing result data.
    :return: None.
    """
    plt.rc('text', usetex=True), plt.rc('font', family='serif', size=20)

    fig = plt.figure()
    plt.subplot(121)  # ShiftDeviation vs. SExistence visualization.
    e_plot(
        cur_i, {
            'table_name': 'QUERY',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'SExistence',
            'params_section': 'query-plot',
            'params_prefix': 'sdse',
            'plot_type': 'BAR'
        })

    plt.subplot(122)  # ShiftDeviation vs. CandidateSetSize visualization.
    p = e_plot(
        cur_i, {
            'table_name': 'QUERY',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'CandidateSetSize',
            'params_section': 'query-plot',
            'params_prefix': 'sdcss',
            'plot_type': 'BAR'
        })
    attach_figure_legend({'params_section': 'query-plot'}, fig, p)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()

    fig = plt.figure()
    p = e_plot(
        cur_i, {
            'table_name': 'QUERY',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'RunningTime',
            'params_section': 'query-plot',
            'params_prefix': 'sdrt',
            'plot_type': 'BAR'
        })
    attach_figure_legend({'params_section': 'query-plot'}, fig, p)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()
Exemplo n.º 2
0
def identification_plots(cur_i):
    """ Display the plots associated with the identification experiment.

    :param cur_i: Cursor to database containing result data.
    :return: None.
    """
    plt.rc('text', usetex=True), plt.rc('font', family='serif', size=20)

    # Plot an empty bar chart for the legend.
    p = e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'PercentageCorrect',
            'constrain_that': 'FalseStars = 0 AND ShiftDeviation < 1.0e-3',
            'params_section': 'identification-plot',
            'params_prefix': 'sdpc',
            'plot_type': 'BAR'
        })
    plt.clf(), plt.cla(), plt.close()

    fig = plt.figure()
    plt.subplot(121)
    e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'PercentageCorrect',
            'constrain_that':
            'FalseStars = 0 AND ShiftDeviation < 1.0e-1 LIMIT 10000',
            'params_section': 'identification-plot',
            'params_prefix': 'sdpc',
            'plot_type': 'BAR_NOERR'
        })

    plt.subplot(122)
    e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'TimeToResult',
            'constrain_that':
            'FalseStars = 0 AND ShiftDeviation < 1.0e-1 LIMIT 10000',
            'params_section': 'identification-plot',
            'params_prefix': 'sdttr',
            'plot_type': 'BAR_NOERR'
        })
    attach_figure_legend({'params_section': 'identification-plot'}, fig, p)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()

    # Plot an empty bar chart for the legend.
    p = e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'ShiftDeviation',
            'y_attribute': 'PercentageCorrect',
            'constrain_that': 'FalseStars = 0 AND ShiftDeviation < 1.0e-3',
            'params_section': 'identification-plot',
            'params_prefix': 'sdpc',
            'plot_type': 'BAR'
        })
    plt.clf(), plt.cla(), plt.close()

    fig = plt.figure()
    plt.subplot(121)
    e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'FalseStars',
            'y_attribute': 'PercentageCorrect',
            'constrain_that':
            'ABS(ShiftDeviation - 0.0) < 1.0e-17 LIMIT 10000',
            'params_section': 'identification-plot',
            'params_prefix': 'fspc',
            'plot_type': 'BAR_NOERR'
        })

    plt.subplot(122)
    e_plot(
        cur_i, {
            'table_name': 'IDENTIFICATION',
            'x_attribute': 'FalseStars',
            'y_attribute': 'TimeToResult',
            'constrain_that':
            'ABS(ShiftDeviation - 0.0) < 1.0e-17 LIMIT 10000',
            'params_section': 'identification-plot',
            'params_prefix': 'fsttr',
            'plot_type': 'BAR_NOERR'
        })

    attach_figure_legend({'params_section': 'identification-plot'}, fig, p)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()
Exemplo n.º 3
0
def overlay_plots(cur_i):
    """ Display the plots associated with the overlay experiment.

    :param cur_i: Cursor to database containing result data.
    :return: None.
    """
    plt.rc('text', usetex=True), plt.rc('font', family='serif', size=20)

    plt.figure()
    plt.subplot(121)  # Sigma4 vs. F1 w/ ShiftDeviation visualization.
    for i in ['0.0', '1.0e-6', '1.0e-5', '1.0e-4', '1.0e-3', '1.0e-2']:
        e_plot(
            cur_i, {
                'table_name':
                'OVERLAY',
                'x_attribute':
                'Sigma4',
                'y_attribute':
                '(TruePositive / (TruePositive + FalseNegative))',
                'constrain_that':
                'ABS(ShiftDeviation - {}) < 1.0e-17 '.format(i) +
                'AND FalseStars = 0 ',
                'params_section':
                'overlay-plot',
                'params_prefix':
                's4as',
                'plot_type':
                'LINE'
            })
    a = plt.legend([
        '0', r'$10^{-6}$', r'$10^{-5}$', r'$10^{-4}$', r'$10^{-3}$',
        r'$10^{-2}$'
    ])
    a.draggable(True)

    plt.subplot(122)  # Sigma4 vs. F1 w/ FalseStars visualization.
    for i in ['0', '3', '6', '9', '12']:
        e_plot(
            cur_i, {
                'table_name':
                'OVERLAY',
                'x_attribute':
                'Sigma4',
                'y_attribute':
                '(TruePositive / (TruePositive + FalseNegative))',
                'constrain_that':
                'ABS(ShiftDeviation - 0.0) < 1.0e-17 '
                'AND FalseStars = {} '.format(i),
                'params_section':
                'overlay-plot',
                'params_prefix':
                's4af',
                'plot_type':
                'LINE'
            })
    a = plt.legend(['0', '3', '6', '9', '12'])
    a.draggable(True)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()
Exemplo n.º 4
0
def query_sigma_plots(cur_i):
    """ Display the plots associated with the query-sigma experiment.

    :param cur_i: Cursor to database containing result data.
    :return: None.
    """
    plt.rc('text', usetex=True), plt.rc('font', family='serif', size=20)

    # Plot an empty bar chart for the legend.
    p = e_plot(
        cur_i, {
            'table_name':
            'QUERY',
            'x_attribute':
            'Sigma1',
            'y_attribute':
            'SExistence',
            'constrain_that':
            '(Sigma2 = Sigma1 OR Sigma2 = 0) '
            'AND (Sigma3 = Sigma1 OR Sigma3 = 0) '
            'AND ShiftDeviation=0 ',
            'params_section':
            'query-sigma-plot',
            'params_prefix':
            's1se',
            'plot_type':
            'BAR'
        })
    plt.clf(), plt.cla(), plt.close()

    fig = plt.figure()
    plt.subplot(121)  # Sigma1 vs. SExistence visualization.
    e_plot(
        cur_i, {
            'table_name':
            'QUERY',
            'x_attribute':
            'Sigma1',
            'y_attribute':
            'SExistence',
            'constrain_that':
            '(Sigma2 = Sigma1 OR Sigma2 = 0) '
            'AND (Sigma3 = Sigma1 OR Sigma3 = 0) '
            'AND ShiftDeviation=0 ',
            'params_section':
            'query-sigma-plot',
            'params_prefix':
            's1se',
            'plot_type':
            'LINE'
        })

    plt.subplot(122)  # Sigma1 vs. CandidateSetSize visualization.
    e_plot(
        cur_i, {
            'table_name':
            'QUERY',
            'x_attribute':
            'Sigma1',
            'y_attribute':
            'CandidateSetSize',
            'constrain_that':
            '(Sigma2 = Sigma1 OR Sigma2 = 0) '
            'AND (Sigma3 = Sigma1 OR Sigma3 = 0) '
            'AND ShiftDeviation=0 ',
            'params_section':
            'query-sigma-plot',
            'params_prefix':
            's1css',
            'plot_type':
            'LINE'
        })
    attach_figure_legend({'params_section': 'query-sigma-plot'}, fig, p)
    plt.subplots_adjust(wspace=0.3,
                        left=0.06,
                        right=0.98,
                        bottom=0.15,
                        top=0.85), plt.show()