<jupyter_start><jupyter_text>Анализ обучения<jupyter_code>def extract_param(info_log, param_name):
    param = []
    for info in info_log:
        param.append(info[param_name])
    
    return param
t = 300000 - 1
file_name = f"data/learning_info/info_{t+1}.pickle"
with open(file_name, 'rb') as f:
    info = pickle.load(f)
for i, cur_info in enumerate(info):
    if len(cur_info) < 150: # or cur_info[-1]["reward"] < 0:
        continue
    print(cur_info[-1]["reward"])
    reward = extract_param(cur_info, "reward")
    plt.title(i)
    plt.plot(reward)
    plt.show()
info[0][0].keys()
reward = extract_param(info[321], "reward")
plt.title(sum(reward) / len(reward) * 500)
plt.plot(reward)
plt.show()
# assert False<jupyter_output><empty_output><jupyter_text>Display Replay<jupyter_code># info_to_replay = [info[242], ] * 3
info_to_replay = info
by = 'action'
# by = 'state'

new_info = []
with SurrogatPyRepEnvironment('scenes/basic_scene.ttt', headless_mode=False, foot_only_mode=True) as env:
    for glob_info in reversed(info_to_replay):
        np.random.seed(0)
        env.reset()
        apliers = extract_param(glob_info, by)
        for aplier in apliers:
            if by == 'action':
                _, _, _, curr_info = env.step(aplier)
            else:
                _, _, _, curr_info = env.replay_step(aplier)
                
            new_info.append(curr_info)

param = extract_param(new_info, "smooth_reward")
# param = extract_param(info[758], "reward")

plt.title(i)
plt.plot(param)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13919178960872355, 'fraction_numerical': 0.01924310455420141, 'mean_word_length': 3.4571428571428573, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '332780', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 613, 'n_tokens_neox': 588, 'n_words': 102, 'path': 'sources/analyse_tqc_learning_info.ipynb', 'repo_name': 'alex-kozinov/Dissertation', 'size': '1559'}