model/utils.py
def aggregate_file_data(data_arr, file_columns):
    """
    Aggregate the 3D file level features into 2D by taking the max, min, etc.

    Args:
        data_arr: A numpy array containing pull request level features,
            file level features, and label. The second column is the file level
            features.
        file_columns: A list of file level feature columns.

    Returns:
        A 2D nested list.
    """
    aggregated_file_data = []
    for lst in data_arr[:, 1]:
        if not lst:
            aggregated_file_data.append(
                [0 for _ in range(8 * len(file_columns))])
            continue
        lst = np.array(lst)[:, file_columns]
        max_ = np.max(lst, axis=0)
        min_ = np.min(lst, axis=0)
        mean_ = np.mean(lst, axis=0)
        percentile_10 = np.percentile(lst, 10, axis=0)
        percentile_30 = np.percentile(lst, 30, axis=0)
        percentile_50 = np.percentile(lst, 50, axis=0)
        percentile_70 = np.percentile(lst, 70, axis=0)
        percentile_90 = np.percentile(lst, 90, axis=0)
        concatenated_data = np.concatenate([max_, min_,
                                            mean_, percentile_10, percentile_30,
                                            percentile_50, percentile_70,
                                            percentile_90], axis=0)
        aggregated_file_data.append(list(concatenated_data))
    return aggregated_file_data

    Aggregate the 3D file level features into 2D by taking the max, min, etc.

    Args:
        data_arr: A numpy array containing pull request level features,
            file level features, and label. The second column is the file level
            features.
        file_columns: A list of file level feature columns.

    Returns:
        A 2D nested list.
    
Aggregate the 3D file level features into 2D by taking the max, min, etc.
Aggregate the 3D file level features into 2D by taking the max min etc .
def aggregate_file_data(data_arr, file_columns):
    aggregated_file_data = []
    for lst in data_arr[:, 1]:
        if not lst:
            aggregated_file_data.append(
                [0 for _ in range(8 * len(file_columns))])
            continue
        lst = np.array(lst)[:, file_columns]
        max_ = np.max(lst, axis=0)
        min_ = np.min(lst, axis=0)
        mean_ = np.mean(lst, axis=0)
        percentile_10 = np.percentile(lst, 10, axis=0)
        percentile_30 = np.percentile(lst, 30, axis=0)
        percentile_50 = np.percentile(lst, 50, axis=0)
        percentile_70 = np.percentile(lst, 70, axis=0)
        percentile_90 = np.percentile(lst, 90, axis=0)
        concatenated_data = np.concatenate([max_, min_,
                                            mean_, percentile_10, percentile_30,
                                            percentile_50, percentile_70,
                                            percentile_90], axis=0)
        aggregated_file_data.append(list(concatenated_data))
    return aggregated_file_data
def aggregate_file_data ( data_arr , file_columns ) : aggregated_file_data = [ ] for lst in data_arr [ : , 1 ] : if not lst : aggregated_file_data . append ( [ 0 for _ in range ( 8 * len ( file_columns ) ) ] ) continue lst = np . array ( lst ) [ : , file_columns ] max_ = np . max ( lst , axis = 0 ) min_ = np . min ( lst , axis = 0 ) mean_ = np . mean ( lst , axis = 0 ) percentile_10 = np . percentile ( lst , 10 , axis = 0 ) percentile_30 = np . percentile ( lst , 30 , axis = 0 ) percentile_50 = np . percentile ( lst , 50 , axis = 0 ) percentile_70 = np . percentile ( lst , 70 , axis = 0 ) percentile_90 = np . percentile ( lst , 90 , axis = 0 ) concatenated_data = np . concatenate ( [ max_ , min_ , mean_ , percentile_10 , percentile_30 , percentile_50 , percentile_70 , percentile_90 ] , axis = 0 ) aggregated_file_data . append ( list ( concatenated_data ) ) return aggregated_file_data
Aggregate the 3D file level features into 2D by taking the max, min, etc.
Aggregate the 3D file level features into 2D by taking the max min etc .
"""
    Aggregate the 3D file level features into 2D by taking the max, min, etc.

    Args:
        data_arr: A numpy array containing pull request level features,
            file level features, and label. The second column is the file level
            features.
        file_columns: A list of file level feature columns.

    Returns:
        A 2D nested list.
    """
A 2D nested list.
A 2D nested list .
data_arr
A numpy array containing pull request level features,
file level features, and label. The second column is the file level
features.
A numpy array containing pull request level features file level features and label . The second column is the file level features .
file_columns
A list of file level feature columns.
A list of file level feature columns .