<jupyter_start><jupyter_text>original<jupyter_code>imp_sum = importances.cpu().sum(dim=0, keepdim=True).abs().t().flip([0])

fig, ax = plt.subplots(1, 1, figsize=(3, 12))

img = ax.pcolormesh(imp_sum, cmap='viridis', edgecolors='black')
fig.colorbar(img)

ax.set_title('Approximate Feature Importance (Summed over timesteps)')

ax.set_ylabel('Features')
ax.set_yticks(np.arange(importances.shape[1]) + 0.5)
ax.set_yticklabels(['o', 'h','l','c','v', 'num_trades', 'taker_buy_base_vol',
                    'posi', 'posi_var', 'posi_entry_cover', 'price', 'price_mean',
                    'reward_fluc', 'makereal', 'reward'][::-1])
# plt.setp(ax.get_xticklabels(), rotation=45, ha="left", rotation_mode="anchor")

ax.set_xticks([])

# for i in range(importances.shape[1]):
#     text = ax.text(0.5, i+0.5, '{:f}'.format(imp_sum[i, 0].item()),
#                    ha="center", va="center", color="b",
#                    path_effects=[PathEffects.withStroke(linewidth=5, foreground='w')])
concat = torch.stack(importances_list)
concat.shape
concat_sum = concat.sum(dim= 1)
imp_sum = concat_sum.t().flip([0]).cpu()

fig, ax = plt.subplots(1, 1, figsize=(3, 12))

img = ax.pcolormesh(imp_sum, cmap='viridis', edgecolors='black')
fig.colorbar(img)

ax.set_title('Approximate Feature Importance (Summed over timesteps)')

ax.set_ylabel('Features')
ax.set_yticks(np.arange(importances.shape[1]) + 0.5)
ax.set_yticklabels(['o', 'h','l','c','v', 'num_trades', 'taker_buy_base_vol',
                    'posi', 'posi_var', 'posi_entry_cover', 'price', 'price_mean',
                    'reward_fluc', 'makereal', 'reward'][::-1])
# plt.setp(ax.get_xticklabels(), rotation=45, ha="left", rotation_mode="anchor")
ax.set_xticks(np.arange(11)+0.5)
ax.set_xticklabels(list(map(str,range(11))))
ax.set_xlabel('Actions')
# for i in range(importances.shape[1]):
#     text = ax.text(0.5, i+0.5, '{:f}'.format(imp_sum[i, 0].item()),
#                    ha="center", va="center", color="b",
#                    path_effects=[PathEffects.withStroke(linewidth=5, foreground='w')])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20783564261825133, 'fraction_numerical': 0.02197802197802198, 'mean_word_length': 4.690217391304348, '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': '345676', 'license': 'MIT', 'n_tokens_mistral': 847, 'n_tokens_neox': 807, 'n_words': 115, 'path': 'agent/PPO/[PPO]AllActionIntegratedGradient.ipynb', 'repo_name': 'limaries30/Binanace-trading-simulation', 'size': '2093'}