<jupyter_start><jupyter_text>Quick analysis<jupyter_code>from phimal_utilities.analysis import Results
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(context='notebook', style='white')

%config InlineBackend.figure_format = 'svg'
data_mt = Results('runs/testing_multitask_unnormalized//')
data_bl = Results('runs/testing_normal_unnormalized//')

keys = data_mt.keys
fig, axes = plt.subplots(figsize=(10, 3), constrained_layout=True, ncols=2)

ax = axes[0]
ax.semilogy(data_bl.df.index, data_bl.df[keys['mse']], label='Baseline')
ax.semilogy(data_mt.df.index, data_mt.df[keys['mse']], label='Multitask')
ax.set_title('MSE')
ax.set_xlabel('Epoch', weight='bold')
ax.set_ylabel('Cost', weight='bold')
ax.legend()
#ax.set_xlim([0, 8000])


ax = axes[1]
ax.semilogy(data_bl.df.index, data_bl.df[keys['reg']], label='Baseline')
ax.semilogy(data_mt.df.index, data_mt.df[keys['reg']], label='Multitask')
ax.set_title('Regression')
ax.set_xlabel('Epoch', weight='bold')
ax.set_ylabel('Cost', weight='bold')
ax.legend()
#ax.set_xlim([0, 8000])

fig.show()
fig, axes = plt.subplots(ncols=3, constrained_layout=True, figsize=(15, 4))

ax = axes[0]
ax.plot(data_bl.df.index, data_bl.df[keys['coeffs']])
ax.plot(data_bl.df.index, data_bl.df[keys['coeffs'][2]], lw=3)
ax.plot(data_bl.df.index, data_bl.df[keys['coeffs'][5]], lw=3)
ax.set_ylim([-2, 2])
ax.set_title('Coefficients baseline')
ax.set_xlabel('Epoch', weight='bold')
ax.set_ylabel('Cost', weight='bold')
#ax.set_xlim([0, 8000])

ax = axes[1]
ax.plot(data_mt.df.index, data_mt.df[keys['coeffs']])
ax.plot(data_mt.df.index, data_mt.df[keys['coeffs'][2]], lw=3)
ax.plot(data_mt.df.index, data_mt.df[keys['coeffs'][5]], lw=3)
ax.set_ylim([-2, 2])
ax.set_title('Coefficients Multitask')
ax.set_xlabel('Epoch', weight='bold')
ax.set_ylabel('Cost', weight='bold')
#ax.set_xlim([0, 8000])

ax = axes[2]
true_coeffs = np.zeros(len(keys['unscaled_coeffs']))
true_coeffs[2] = 0.1
true_coeffs[5] = -1

ax.semilogy(data_bl.df.index, np.mean(np.abs(data_bl.df[keys['unscaled_coeffs']] - true_coeffs), axis=1), label='Baseline')
ax.semilogy(data_mt.df.index, np.mean(np.abs(data_mt.df[keys['unscaled_coeffs']] - true_coeffs), axis=1), label='Baseline')
ax.set_ylim([-5, 2])
ax.legend()

fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20853497580290364, 'fraction_numerical': 0.02375714914210295, 'mean_word_length': 7.91764705882353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '1473', 'license': 'MIT', 'n_tokens_mistral': 1032, 'n_tokens_neox': 988, 'n_words': 131, 'path': 'notebooks/testing_multitask.ipynb', 'repo_name': 'GJBoth/MultiTaskPINN', 'size': '2273'}