(matrices, categories_list, output_combined_file_name)
Generates a csv file with all samples as rows and columns as the combination of all possible categories
    :param matrices: a dictionary with keys as apk names (hashes) and values as the 2d matrix
    :param categories_list: list of categories from prmDomains
    :param output_combined_file_name: name of the file to save the combined csv
Generates a csv file with all samples as rows and columns as the combination of all possible categories
    :param matrices: a dictionary with keys as apk names (hashes) and values as the 2d matrix
    :param categories_list: list of categories from prmDomains
    :param output_combined_file_name: name of the file to save the combined csv
Generates a csv file with all samples as rows and columns as the combination of all possible categories : param matrices : a dictionary with keys as apk names ( hashes ) and values as the 2d matrix : param categories_list : list of categories from prmDomains : param output_combined_file_name : name of the file to save the combined csv
def combine_matrices(matrices, categories_list, output_combined_file_name):
    """
    Generates a csv file with all samples as rows and columns as the combination of all possible categories
    :param matrices: a dictionary with keys as apk names (hashes) and values as the 2d matrix
    :param categories_list: list of categories from prmDomains
    :param output_combined_file_name: name of the file to save the combined csv
    """
    # Permutations with repetition of all categories
    categories_combined_list = [[x + "-" + y for y in categories_list] for x in categories_list]

    # Flattening of categories combinations list
    categories_combined_list = [x for row in categories_combined_list for x in row]

    # Flattening of each app 2d matrix
    vectors = []
    for index, apk_key in enumerate(matrices.keys()):
        matrix = matrices[apk_key]
        vectors.append([apk_key] + [x for row in matrix for x in row])

    # Writing the whole matrix to a csv file
    with open(output_combined_file_name, 'wb') as myfile:
        wr = csv.writer(myfile)
        wr.writerow(["apk"] + categories_combined_list)
        for row in vectors:
            wr.writerow(row)
def combine_matrices ( matrices , categories_list , output_combined_file_name ) : # Permutations with repetition of all categories categories_combined_list = [ [ x + "-" + y for y in categories_list ] for x in categories_list ] # Flattening of categories combinations list categories_combined_list = [ x for row in categories_combined_list for x in row ] # Flattening of each app 2d matrix vectors = [ ] for index , apk_key in enumerate ( matrices . keys ( ) ) : matrix = matrices [ apk_key ] vectors . append ( [ apk_key ] + [ x for row in matrix for x in row ] ) # Writing the whole matrix to a csv file with open ( output_combined_file_name , 'wb' ) as myfile : wr = csv . writer ( myfile ) wr . writerow ( [ "apk" ] + categories_combined_list ) for row in vectors : wr . writerow ( row )