This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import numpy as np | |
from sklearn.grid_search import GridSearchCV | |
def print_GridCV_scores(gs_clf, export_file): | |
'''Exports a CSV of the GridCV scores. | |
gs_clf: A GridSearchCV object which has been fitted | |
export_file: A file path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# Return the longest common suffix in a list of strings | |
def longest_common_suffix(list_of_strings): | |
reversed_strings = [' '.join(s.split()[::-1]) for s in list_of_strings] | |
reversed_lcs = os.path.commonprefix(reversed_strings) | |
lcs = ' '.join(reversed_lcs.split()[::-1]) | |
return lcs |