def get_most_important_features(vectorizer, model, n=5):
    """
    This function returns the most important words
    starting from the most important to he least important 
    that the algorithm used to learn
    Inputs:
        vectorizer >> The Vectorizer object TF-Idf or CountVectorizer
        model >> the algorithm object of LogisticRegression class
        n >> the number of returned words
    """
    index_to_word = {v:k for k,v in vectorizer.vocabulary_.items()}
    
    # loop for each class
    classes ={}
    for class_index in range(model.coef_.shape[0]):
        word_importances = [(el, index_to_word[i]) for i,el in enumerate(model.coef_[class_index])]
        sorted_coeff = sorted(word_importances, key = lambda x : x[0], reverse=True)
        tops = sorted(sorted_coeff[:n], key = lambda x : x[0])
        bottom = sorted_coeff[-n:]
        classes[class_index] = {
            'tops':tops,
            'bottom':bottom
        }
    return classes