visualization.py v 1.0.0.001

This commit is contained in:
ltcptgeneral 2020-05-05 22:37:32 -05:00
parent f36bc9ac13
commit 55e22df665

View File

@ -6,10 +6,12 @@
# fancy # fancy
# setup: # setup:
__version__ = "1.0.0.000" __version__ = "1.0.0.001"
#changelog should be viewed using print(analysis.__changelog__) #changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog: __changelog__ = """changelog:
1.0.0.001:
- added graphhistogram function as a fragment of visualize_pit.py
1.0.0.000: 1.0.0.000:
- created visualization.py - created visualization.py
- added graphloss() - added graphloss()
@ -26,9 +28,31 @@ __all__ = [
] ]
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
def graphloss(losses): def graphloss(losses):
x = range(0, len(losses)) x = range(0, len(losses))
plt.plot(x, losses) plt.plot(x, losses)
plt.show() plt.show()
def graphhistogram(data, figsize, sharey = True): # expects library with key as variable and contents as occurances
fig, ax = plt.subplots(1, len(data), sharey=sharey, figsize=figsize)
i = 0
for variable in data:
ax[i].hist(data[variable])
ax[i].invert_xaxis()
ax[i].set_xlabel('Variable')
ax[i].set_ylabel('Frequency')
ax[i].set_title(variable)
plt.yticks(np.arange(len(data[variable])))
i+=1
plt.show()