Skip to content
Snippets Groups Projects
Commit 0ea8ae4c authored by Dennis Noll's avatar Dennis Noll
Browse files

[plotting] adds plot label count function + removed norm of activation hists

parent 277809ff
Branches
No related tags found
No related merge requests found
...@@ -81,6 +81,23 @@ def figure_activations(activations, class_names=None): ...@@ -81,6 +81,23 @@ def figure_activations(activations, class_names=None):
return fig return fig
def figure_y(y, class_names=None, relative=False):
n_p = y.shape[1]
bins = range(n_p)
fig = plt.figure()
values = y.sum(axis=0)
if relative:
values = values / values.sum()
plt.bar(bins, values)
plt.xticks(bins, class_names, rotation=45)
plt.yscale("log")
plt.xlabel("Classfication Process")
plt.ylabel("Number of Events" + relative * " (normed)")
fig.tight_layout()
return fig
def figure_node_activations( def figure_node_activations(
activations, truth, class_names=None, disjoint=False, sample_weight=None activations, truth, class_names=None, disjoint=False, sample_weight=None
): ):
...@@ -110,7 +127,7 @@ def figure_node_activations( ...@@ -110,7 +127,7 @@ def figure_node_activations(
ax_index = quad.index(node) ax_index = quad.index(node)
for process in range(n_p): for process in range(n_p):
label = "%i" % process if class_names is None else class_names[process] label = "%i" % process if class_names is None else class_names[process]
plot_kwargs = {"histtype": "step", "density": True, "label": label, "range": (0.0, 1.0)} plot_kwargs = {"histtype": "step", "label": label, "range": (0.0, 1.0)}
if len(process_weights) == n_p: if len(process_weights) == n_p:
plot_kwargs["weights"] = process_weights[process] plot_kwargs["weights"] = process_weights[process]
ax[ax_index].hist(process_activations[process][node], bins, **plot_kwargs) ax[ax_index].hist(process_activations[process][node], bins, **plot_kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment