def read_output_best_index(output_folder):
    """
    Given the output_folder, where the svm output is located in
    src/SVM/output_folder/output
    Finds the highest rank and returns its index
    """

    # Location of file where SVM Rank results are stored
    output_file = "src/SVM/" + output_folder + "/output"

    best_rank = -1000000  # Set default to extremely negative number
    best_index = -1
    curr_index = 0

    # Find the index with the highest ranking in the output file
    with open(output_file) as f:
        for line in f:
            line = float(line)
            if line > best_rank:
                best_rank = line
                best_index = curr_index

            # Increment line index
            curr_index += 1

    return best_index