def plot_matrix(dataset_ids):
    matrix = []
    for dataset_id in dataset_ids:
        dataset_values = []
        for technique_id in technique_list:
            history = Parser.parse_rectangles(technique_id, dataset_id)
            avg = compute_location_drift(history)
            dataset_values.append(avg)
            print(Globals.acronyms[technique_id], dataset_id, avg)
        matrix.append(dataset_values)

    matrix = np.array(matrix).transpose()

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    cell_text=True,
                    title='Location Drift')
def plot_matrix(dataset_ids):
    matrix = []
    for dataset_id in dataset_ids:
        dataset_values = []
        for technique_id in technique_list:
            history = Parser.parse_rectangles(technique_id, dataset_id)
            all_ratios = np.array([])
            for revision in range(len(history) - 1):
                distances = compute_shneiderman(history[revision],
                                                history[revision + 1])
                all_ratios = np.append(all_ratios, distances.values)

            dataset_values.append(all_ratios.mean())
            print(Globals.acronyms[technique_id], dataset_id,
                  all_ratios.mean())
        matrix.append(dataset_values)

    matrix = np.array(matrix).transpose()

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    cell_text=True,
                    title='Shneiderman-Wattenberg')
Exemple #3
0
def pearson_matrix(dataset_ids):
    matrix = []
    for dataset_id in dataset_ids:
        dataset_values = []
        for technique_id in technique_list:
            # print(Globals.acronyms[technique_id], dataset_id)
            history = Parser.parse_rectangles(technique_id, dataset_id)
            # Compute all delta_vis and delta_data values for a dataset (1 pair per cell)
            all_delta_data = np.array([])
            all_delta_vis = np.array([])
            for revision in range(len(history) - 1):
                delta_data = DeltaMetrics.compute_delta_data(history[revision], history[revision + 1])
                all_delta_data = np.append(all_delta_data, delta_data)

                delta_vis = DeltaMetrics.compute_delta_vis(history[revision], history[revision + 1])
                all_delta_vis = np.append(all_delta_vis, delta_vis)

            # Compute linear regression statistics
            slope, intercept, r_value, p_value, std_err = stats.linregress(all_delta_data, all_delta_vis)

            dataset_values.append(r_value)
            print(Globals.acronyms[technique_id], dataset_id, r_value)
        matrix.append(dataset_values)

    matrix = np.array(matrix).transpose()

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=False,
                    cell_text=True,
                    title='Pearson')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=True,
                    cell_text=True,
                    title='Pearson')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=False,
                    cell_text=False,
                    title='Pearson')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=True,
                    cell_text=False,
                    title='Pearson')
Exemple #4
0
def plot_ar_matrix(dataset_ids):
    matrix = []
    for dataset_id in dataset_ids:
        dataset_values = []
        for technique_id in technique_list:
            history = Parser.parse_rectangles(technique_id, dataset_id)
            all_ratios = np.array([])
            for revision in range(len(history) - 1):
                ratios = compute_aspect_ratios(history[revision])
                all_ratios = np.append(all_ratios, ratios.values)

            dataset_values.append(all_ratios.mean())
            print(Globals.acronyms[technique_id], dataset_id,
                  all_ratios.mean())
        matrix.append(dataset_values)

    matrix = np.array(matrix).transpose()

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    shared_cm=False,
                    cell_text=True,
                    title='Aspect ratio')

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    shared_cm=True,
                    cell_text=True,
                    title='Aspect ratio')

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    shared_cm=False,
                    cell_text=False,
                    title='Aspect ratio')

    MatrixPlot.plot(matrix,
                    dataset_ids,
                    technique_list,
                    shared_cm=True,
                    cell_text=False,
                    title='Aspect ratio')
Exemple #5
0
def delta_ratio_matrix(dataset_ids):
    matrix = []
    for dataset_id in dataset_ids:
        dataset_values = []
        for technique_id in technique_list:
            history = Parser.parse_rectangles(technique_id, dataset_id)
            all_ratios = np.array([])
            for revision in range(len(history) - 1):
                delta_vis = compute_delta_vis(history[revision], history[revision + 1])
                delta_data = compute_delta_data(history[revision], history[revision + 1])
                ratio = (1 - delta_vis) / (1 - delta_data)
                all_ratios = np.append(all_ratios, ratio.values)

            dataset_values.append(all_ratios.mean())
            print(Globals.acronyms[technique_id], dataset_id, all_ratios.mean())
        matrix.append(dataset_values)

    matrix = np.array(matrix).transpose()

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=False,
                    cell_text=True,
                    title='Delta ratio')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=True,
                    cell_text=True,
                    title='Delta ratio')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=False,
                    cell_text=False,
                    title='Delta ratio')

    MatrixPlot.plot(matrix, dataset_ids, technique_list,
                    shared_cm=True,
                    cell_text=False,
                    title='Delta ratio')
    dataset_id = sys.argv[2:]
    LocationDrift.plot_matrix(dataset_id)

# Sondag's Relative Position Change
elif action == 'rpc-boxplots':
    dataset_id = sys.argv[2]
    RelativePositionChange.plot_time_boxplot(dataset_id)

elif action == 'rpc-matrix':
    dataset_ids = sys.argv[2:]
    RelativePositionChange.plot_matrix(dataset_ids)

# Plots any csv, avoiding recomputing a whole metric matrix
elif action == 'generic-matrix':
    title = sys.argv[2]
    csv_path = sys.argv[3]
    MatrixPlot.generic_plot(title, csv_path)

# Create the rank count for the Google Drive document
elif action == 'rank-counter':
    csv_paths = sys.argv[2:]
    RankCounter.count_to_csv(csv_paths)

# Centroid Trail Visualization
elif action == 'centroid-trail':
    dataset_id = sys.argv[2]
    CentroidTrail.plot(dataset_id)

else:
    print('Invalid command. See the readme file.')