def form_user_label_matrix(user_twitter_list_keywords_gen, id_to_node, max_number_of_labels):
    """
    Forms the user-label matrix to be used in multi-label classification.

    Input:   - user_twitter_list_keywords_gen:
             - id_to_node:  A Twitter id to node map as a python dictionary.

    Outputs: - user_label_matrix: A user-to-label matrix in scipy sparse matrix format.
             - annotated_nodes: A numpy array containing graph nodes.
             - label_to_lemma: A python dictionary that maps a numerical label to a string topic lemma.
             - lemma_to_keyword: A python dictionary that maps a lemma to the original keyword.
    """
    user_label_matrix, annotated_nodes, label_to_lemma, node_to_lemma_tokeywordbag = form_user_term_matrix(user_twitter_list_keywords_gen,
                                                                                                           id_to_node,
                                                                                                           None)

    # write_terms_and_frequencies("/home/georgerizos/Documents/term_matrix.txt", user_label_matrix, label_to_lemma)

    user_label_matrix, annotated_nodes, label_to_lemma = filter_user_term_matrix(user_label_matrix,
                                                                                 annotated_nodes,
                                                                                 label_to_lemma,
                                                                                 max_number_of_labels)

    # write_terms_and_frequencies("/home/georgerizos/Documents/label_matrix.txt", user_label_matrix, label_to_lemma)

    lemma_to_keyword = form_lemma_tokeyword_map(annotated_nodes, node_to_lemma_tokeywordbag)

    return user_label_matrix, annotated_nodes, label_to_lemma, lemma_to_keyword
Forms the user-label matrix to be used in multi-label classification.

    Input:   - user_twitter_list_keywords_gen:
             - id_to_node:  A Twitter id to node map as a python dictionary.

    Outputs: - user_label_matrix: A user-to-label matrix in scipy sparse matrix format.
             - annotated_nodes: A numpy array containing graph nodes.
             - label_to_lemma: A python dictionary that maps a numerical label to a string topic lemma.
             - lemma_to_keyword: A python dictionary that maps a lemma to the original keyword.