21971e673fabe25d3e7da6712f80222760516113,server/website/website/tasks/async_tasks.py,,clean_metric_data,#Any#Any#Any#,149

Before Change


            // append a missing column after the last column
            index = matrix.shape[1]  // pylint: disable=unsubscriptable-object
            default_val = 0
            matrix = np.insert(matrix, index, default_val, axis=1)
            metric_labels.append(metric)
    LOG.debug(matrix.shape)
    // If they are useless columns in the matrix
    if unused_columns:
        indexes = [i for i, n in enumerate(metric_labels) if n in unused_columns]
        // Delete unused columns
        matrix = np.delete(matrix, indexes, 1)
        for i in sorted(indexes, reverse=True):
            del metric_labels[i]
    return matrix, metric_labels


def save_execution_time(start_ts, fn, result):

After Change


              len(unused_columns))
    default_val = 0
    metric_cat_size = len(metric_cat)
    matrix = np.ones((len(metric_matrix), metric_cat_size)) * default_val
    metric_labels_dict = {n: i for i, n in enumerate(metric_labels)}
    // column labels in matrix has the same order as ones in metric catalog
    // missing values are filled with default_val
    for i, metric_name in enumerate(metric_cat):
        if metric_name in metric_labels_dict:
            index = metric_labels_dict[metric_name]
            matrix[:, i] = metric_matrix[:, index]
    LOG.debug(matrix.shape)
    return matrix, metric_cat
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: cmu-db/ottertune
Commit Name: 21971e673fabe25d3e7da6712f80222760516113
Time: 2020-02-26
Author: bohanzhang95@gmail.com
File Name: server/website/website/tasks/async_tasks.py
Class Name:
Method Name: clean_metric_data


Project Name: p2irc/deepplantphenomics
Commit Name: 83af0d9266d3650c0260faf8c6d9a4b97389d75b
Time: 2019-09-26
Author: dbl599@mail.usask.ca
File Name: deepplantphenomics/classification_model.py
Class Name: ClassificationModel
Method Name: forward_pass_with_file_inputs


Project Name: p2irc/deepplantphenomics
Commit Name: b0acdf5e8a149fb7369f4fd0c87fc62f06786426
Time: 2019-09-27
Author: dbl599@mail.usask.ca
File Name: deepplantphenomics/regression_model.py
Class Name: RegressionModel
Method Name: forward_pass_with_file_inputs