<jupyter_start><jupyter_text>Tea Time  Load<jupyter_code>import optuna

def objective(trial):
    brewing_duration = trial.suggest_float('brewing_duration', 12, 25)
    how_many_desert_spoon_of_tea = trial.suggest_float('how_many_desert_spoon_of_tea', 4, 10)
    how_many_desert_spoon_of_sugar = trial.suggest_float('how_many_desert_spoon_of_sugar', 0, 1)
    when_to_add_sugar = trial.suggest_float('when_to_add_sugar', 0, brewing_duration)
    keep_spout_closed_while_brewing = trial.suggest_categorical("keep_spout_closed_while_brewing", [True, False])
    oven_power = trial.suggest_int("oven_power", 1, 4)
    use_big_heater = trial.suggest_categorical("use_big_heater", [True, False])
    
    print("MAKE YOUR TEA WITH THESE PARAMETERS:")
    for k,v in trial.params.items():
        print("[" + k + "]:", round(v,2))

    print("How was your tea?")
    taste = input("Taste (0-100): ")
    smell = input("Smell (0-100): ")
    after_drink = input("After Drink (0-100): ")
    return score(float(taste), float(smell), float(after_drink))

def score(taste, smell, after_drink):
    return taste*0.4 + smell*0.4 + after_drink*0.2

study_name = "turkish-tea"  # Unique identifier of the study.
storage_name = "sqlite:///{}.db".format(study_name)
study = optuna.create_study(study_name=study_name, storage=storage_name, load_if_exists=True, direction="maximize")<jupyter_output>[32m[I 2021-11-01 20:57:02,510][0m Using an existing study with name 'turkish-tea' instead of creating a new one.[0m<jupyter_text>Best Parameters<jupyter_code>print("Best parameters:")
for k,v in study.best_params.items():
    print("[" + k + "]:", round(v,2))<jupyter_output><empty_output><jupyter_text>Old Trials<jupyter_code>study.trials_dataframe()<jupyter_output><empty_output><jupyter_text>Iterate (Make a tea!)<jupyter_code>study.optimize(objective, n_trials=1)<jupyter_output>MAKE YOUR TEA WITH THESE PARAMETERS:
[brewing_duration]: 15.41
[how_many_desert_spoon_of_tea]: 5.29
[how_many_desert_spoon_of_sugar]: 0.08
[when_to_add_sugar]: 0.76
[keep_spout_closed_while_brewing]: 0
[oven_power]: 1
[is_big_oven]: 1
Taste: 2
Smell: 5
After Drink: 10
{'fraction_non_alphanumeric': 0.1352996254681648, 'fraction_numerical': 0.03464419475655431, 'mean_word_length': 6.4982456140350875, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '192298', 'license': 'MIT', 'n_tokens_mistral': 906, 'n_tokens_neox': 832, 'n_words': 142, 'path': 'tea_time.ipynb', 'repo_name': 'salihmarangoz/turkish_tea_optimization', 'size': '2136'}