<jupyter_start><jupyter_text>Where do I start? Summarize current and past experiments<jupyter_code>summary = flor.versionSummaries('coarse')
summary<jupyter_output><empty_output><jupyter_text>What is the best experiment?Here, we measure _goodness_ of an experiment by its max model accuracy, over all trials.<jupyter_code>summary_stat = summary.groupby('__commitHash__')['model_accuracy'].max()
summary_stat
best_commit_hash = summary_stat.idxmax()
best_commit_hash[0:5] + '...'<jupyter_output><empty_output><jupyter_text>What is the best trial, given the best experiment?<jupyter_code>best_index = summary.loc[summary['__commitHash__'] == best_commit_hash]['model_accuracy'].idxmax()
best_trial = summary.iloc[best_index]['__trialNum__']
best_trial<jupyter_output><empty_output><jupyter_text>So the former experiment is better than the latter. What changed?<jupyter_code>versions = summary.__commitHash__.unique()
most_recent, least_recent = versions
flor.diffExperimentVersions('twitter_demo', least_recent, most_recent)<jupyter_output><empty_output><jupyter_text>Let's get the best model yet!From the best trial, from the best experiment<jupyter_code>best_model = flor.checkoutArtifact('twitter_demo', best_trial, best_commit_hash, 'model.pkl')<jupyter_output><empty_output><jupyter_text>Here's the best model in action<jupyter_code>country_dict = best_model['country_dict']
classifier = best_model['classifier']
vectorizer = best_model['vectorizer']

code_dict = {}

for kee in country_dict:
    code_dict[country_dict[kee]] = kee

while True:
    tweet = input("What's on your mind? ")
    if tweet == 'exit':
        break
    tweet_vec = vectorizer.transform(np.array([tweet,]))
    country_id = classifier.predict(tweet_vec)
    print("Predicted country of origin: {}\n".format(code_dict[country_id[0]]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11509229098805646, 'fraction_numerical': 0.0016286644951140066, 'mean_word_length': 8.403061224489797, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '26541', 'license': 'Apache-2.0', 'n_tokens_mistral': 623, 'n_tokens_neox': 606, 'n_words': 118, 'path': 'src/flor-0.0.0-alpha/examples/FlorDemo.ipynb', 'repo_name': 'ucbrise/flor-camp2018', 'size': '1842'}