mirror of
https://github.com/codex-storage/das-research.git
synced 2025-02-23 08:18:14 +00:00
Added heatmaps of netDegree vs maliciousNodes on Missing Samples
This commit is contained in:
parent
42356a8a39
commit
1dae18a022
@ -1070,6 +1070,7 @@ class Visualizor:
|
|||||||
plt.ylabel(conf['ylabel'])
|
plt.ylabel(conf['ylabel'])
|
||||||
plt.title(conf['title'])
|
plt.title(conf['title'])
|
||||||
plt.savefig(f"results/{self.execID}/heatmaps/{conf['path']}")
|
plt.savefig(f"results/{self.execID}/heatmaps/{conf['path']}")
|
||||||
|
plt.clf()
|
||||||
|
|
||||||
# x -> network degree, y -> number of nodes, weights -> simulation duration
|
# x -> network degree, y -> number of nodes, weights -> simulation duration
|
||||||
def plotNWDegVsNodeOnRuntime(self):
|
def plotNWDegVsNodeOnRuntime(self):
|
||||||
@ -1085,8 +1086,32 @@ class Visualizor:
|
|||||||
'weights': weights,
|
'weights': weights,
|
||||||
'xlabel': 'Net Degree',
|
'xlabel': 'Net Degree',
|
||||||
'ylabel': 'Number of Nodes',
|
'ylabel': 'Number of Nodes',
|
||||||
'title': 'Heatmap of Net Degree, Number of Nodes & Simulation Runtime',
|
'title': 'Net Degree vs. Number of Nodes on Simulation Runtime',
|
||||||
'path': 'NWDegNodeDuration.png'
|
'path': 'NWDegVsNodeOnRuntime.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
self.plotHeatMapData(conf)
|
||||||
|
|
||||||
|
# x -> network degree, y -> % of malicious nodes, weights -> no of missing samples
|
||||||
|
def plotNWDegVsMalNodeOnMissingSamples(self):
|
||||||
|
x = [result.shape.netDegree for result in self.results]
|
||||||
|
y = [result.shape.maliciousNodes for result in self.results]
|
||||||
|
weights = [result.missingVector[-1] for result in self.results]
|
||||||
|
|
||||||
|
if len(set(x)) * len(set(y)) < 2: return # Not enough unique params for heatmap
|
||||||
|
|
||||||
|
conf = {
|
||||||
|
'x': x,
|
||||||
|
'y': y,
|
||||||
|
'weights': weights,
|
||||||
|
'xlabel': 'Net Degree',
|
||||||
|
'ylabel': 'Malicious Nodes (%)',
|
||||||
|
'title': 'Net Degree vs Malicious Nodes (%) on Missing Samples',
|
||||||
|
'path': 'NWDegVsMalNodeOnMissingSamples.png'
|
||||||
}
|
}
|
||||||
|
|
||||||
self.plotHeatMapData(conf)
|
self.plotHeatMapData(conf)
|
||||||
|
|
||||||
|
def plotAllHeatMaps(self):
|
||||||
|
self.plotNWDegVsNodeOnRuntime()
|
||||||
|
self.plotNWDegVsMalNodeOnMissingSamples()
|
2
study.py
2
study.py
@ -93,7 +93,7 @@ def study():
|
|||||||
|
|
||||||
visual = Visualizor(execID, config, results)
|
visual = Visualizor(execID, config, results)
|
||||||
visual.plotHeatmaps("nn", "fr")
|
visual.plotHeatmaps("nn", "fr")
|
||||||
visual.plotNWDegVsNodeOnRuntime()
|
visual.plotAllHeatMaps()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
study()
|
study()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user