<jupyter_start><jupyter_text>Initiailize VW executor<jupyter_code>from vw_executor.vw import Vw

vw = Vw('vw', '.vw_cache')<jupyter_output><empty_output><jupyter_text>Get the data<jupyter_code>inputs = [
    #'file1.json',
    #'file2.json',
    ]
inputs<jupyter_output><empty_output><jupyter_text>Define options grid and train<jupyter_code>from vw_executor.vw_opts import dimension, product
import pandas as pd

opts = pd.DataFrame(product(
    dimension('#base', ['--ccb_explore_adf -P 100 --preserve_performance_counters --save_resume --dsjson']),
    dimension('--cb_type', ['ips', 'mtr']),
))
opts
result = vw.train(inputs, opts)
result<jupyter_output><empty_output><jupyter_text>Explore metrics<jupyter_code>result.iloc[0]['!Metrics'].head()
import matplotlib.pyplot as plt
[(-r['!Metrics']['loss_per_example']).plot(label=f"{r['!Job'].name}", figsize=(10,6)) for i, r in result[result['!Loss'].notnull()].iterrows()]
plt.legend()<jupyter_output><empty_output><jupyter_text>Choose the best and try other options on top<jupyter_code>best1 = result.sort_values(by='!Loss').head(1)
best1
opts = pd.DataFrame(product(best1, 
    dimension('-l', ['0.1', '0.2'])))
opts
result = vw.train(inputs, opts)
result<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17205169628432956, 'fraction_numerical': 0.013731825525040387, 'mean_word_length': 7.428571428571429, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '256032', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 493, 'n_tokens_neox': 478, 'n_words': 76, 'path': 'from_mwt_ds/DataScience/sweep_local.ipynb', 'repo_name': 'kammitama5/data-science', 'size': '1238'}