<jupyter_start><jupyter_text>A fit example: Higgs decays  Fit on the expected counts<jupyter_code>import alldecays
import matplotlib.pyplot as plt
import numpy as np

# The following import loads a typical setup procedure.
from higgs_data_setup import combi_data_set


def fit_step(minuit_object):
    # minuit_object.throw_nan = True
    minuit_object.print_level = 0
    minuit_object.migrad(ncall=10_000)


# fit_mode = "Multinomial"  # Not implemented yet.
# fit_mode = "Poisson"
fit_mode = "BinomialLeastSquares"
# fit_mode = "GaussianLeastSquares"
fit = alldecays.Fit(combi_data_set, fit_mode, fit_step=fit_step, has_limits=True)
fit.Minuit
fit._data_set.fit_start_brs
fit.fit_mode.values<jupyter_output><empty_output><jupyter_text>Toy fits for uncertainty estimation<jupyter_code>rng = np.random.default_rng(seed=5)
toy_values = fit.fill_toys(10_000, store_channel_counts=True)
# alldecays.plotting.toy_hists(fit)<jupyter_output><empty_output><jupyter_text>Create all the standard plots<jupyter_code>! mkdir -p img
figs = alldecays.all_plots(fit, "img", experiment_tag="ILD_preliminary")
plt.close("all")  # To not clutter this cell's output with all figures.
figs
list(figs.values())[-1]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09714285714285714, 'fraction_numerical': 0.010612244897959184, 'mean_word_length': 7.173333333333333, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '69587', 'license': 'Apache-2.0', 'n_tokens_mistral': 478, 'n_tokens_neox': 456, 'n_words': 89, 'path': 'example/higgs_ILD/fit_example.ipynb', 'repo_name': 'LLR-ILD/alldecays', 'size': '1225'}