# Plotting of the prediction output and error outputFolderName = "Outputs/Erdos_Renyi_Outputs" + datetime.now().strftime("%Y_%m_%d_%H_%M_%S") os.mkdir(outputFolderName) outplot = outputPlot.OutputPlot( outputFolderName + "/Prediction.html", "Mackey-Glass Time Series - GA Optimization)", "Prediction on Testing data", "Time", "Output", ) outplot.setXSeries(np.arange(1, nValidation + nTesting + 1)) outplot.setYSeries("Actual Output", actualOutputData) outplot.setYSeries("Predicted Output", predictedOutputData) outplot.createOutput() # Plotting of the best population details # utilityGA.plotNetworkPerformance(bestPopulation, topology=utilityGA.Topology.ErdosRenyi, fileName=outputFolderName+"/NetworkPerformance.html", networkSize=networkSize) # Store the best population in a file (for later analysis) popFileName = outputFolderName + "/population.pkl" utilityGA.storeBestPopulationAndStats(bestPopulation, popFileName, utilityGA.Topology.ErdosRenyi, networkSize) # Load the best population print(utilityGA.loadBestPopulation(popFileName)) endTime = time() run_time = endTime - startTime print("The run time:" + str(run_time)) print("Done!")
from reservoir import GAUtility as utilityGA from plotting import ScatterPlot as plot import numpy as np import os from datetime import datetime # File name for folderName = "Outputs/GAResults_Small_World_Graphs_" + datetime.now().strftime( "%Y_%m_%d_%H_%M_%S") os.mkdir(folderName) # Load the best population from the file bestPopulation = utilityGA.loadBestPopulation("population.pkl") # Iterate over all the elements and get the network properties networkSize = 500 meanDegreeList = [] betaList = [] errorList = [] averageDegreeList = [] averagePathLengthList = [] averageDiameterList = [] averageClusteringCoefficientList = [] for item in bestPopulation: # Fitness meanDegree = item[0][0, 0] beta = item[0][0, 1] error = item[1] # Network properties averageDegree = item[2]['averageDegree'] averagePathLength = item[2]['averagePathLength']
#Plotting of the prediction output and error outputFolderName = "Outputs/Random_Graph_Outputs" + datetime.now().strftime( "%Y_%m_%d_%H_%M_%S") os.mkdir(outputFolderName) outplot = outputPlot.OutputPlot(outputFolderName + "/Prediction.html", "Mackey-Glass Time Series - GA Optimization)", "Prediction on Testing data", "Time", "Output") outplot.setXSeries(np.arange(1, nValidation + nTesting + 1)) outplot.setYSeries('Actual Output', actualOutputData) outplot.setYSeries('Predicted Output', predictedOutputData) outplot.createOutput() # Plotting of the best population details utilityGA.plotNetworkPerformance(bestPopulation, topology=utilityGA.Topology.Random, fileName=outputFolderName + "/NetworkPerformance.html", networkSize=networkSize) # Store the best population in a file (for later analysis) popFileName = outputFolderName + "/population.pkl" utilityGA.storeBestPopulationAndStats(bestPopulation, popFileName, utilityGA.Topology.Random, networkSize) # Load the best population print(utilityGA.loadBestPopulation(popFileName)) endTime = time() run_time = endTime - startTime print("The run time:" + str(run_time)) print("Done!")
from reservoir import GAUtility as utilityGA from plotting import ScatterPlot as plot import numpy as np import os from datetime import datetime # File name for folderName = "Outputs/GAResults_Combined_" + datetime.now().strftime( "%Y_%m_%d_%H_%M_%S") os.mkdir(folderName) # Load the best population from the file bestPopulationErdos = utilityGA.loadBestPopulation("erdos.pkl") bestPopulationScaleFree = utilityGA.loadBestPopulation("scalefree.pkl") bestPopulationSmallWorld = utilityGA.loadBestPopulation("smallworld.pkl") bestPopulationList = [ bestPopulationErdos, bestPopulationScaleFree, bestPopulationSmallWorld ] # Iterate over all the elements and get the network properties networkSize = 500 errorList = [] averageDegreeList = [] averagePathLengthList = [] averageDiameterList = [] averageClusteringCoefficientList = [] for bestPopulation in bestPopulationList: for item in bestPopulation: # Fitness
from reservoir import GAUtility as utilityGA from plotting import ScatterPlot as plot import numpy as np import os from datetime import datetime # File name for folderName = "Outputs/GAResults_Small_World_Graphs_" + datetime.now().strftime("%Y_%m_%d_%H_%M_%S") os.mkdir(folderName) # Load the best population from the file bestPopulation = utilityGA.loadBestPopulation("population.pkl") # Iterate over all the elements and get the network properties networkSize = 500 meanDegreeList = [] betaList = [] errorList = [] averageDegreeList = [] averagePathLengthList = [] averageDiameterList = [] averageClusteringCoefficientList = [] for item in bestPopulation: # Fitness meanDegree = item[0][0,0] beta = item[0][0,1] error = item[1] # Network properties averageDegree = item[2]['averageDegree']
from reservoir import GAUtility as utilityGA from plotting import ScatterPlot as plot import numpy as np import os from datetime import datetime # File name for folderName = "Outputs/GAResults_Combined_" + datetime.now().strftime("%Y_%m_%d_%H_%M_%S") os.mkdir(folderName) # Load the best population from the file bestPopulationErdos = utilityGA.loadBestPopulation("erdos.pkl") bestPopulationScaleFree = utilityGA.loadBestPopulation("scalefree.pkl") bestPopulationSmallWorld = utilityGA.loadBestPopulation("smallworld.pkl") bestPopulationList = [bestPopulationErdos, bestPopulationScaleFree, bestPopulationSmallWorld] # Iterate over all the elements and get the network properties networkSize = 500 errorList = [] averageDegreeList = [] averagePathLengthList = [] averageDiameterList = [] averageClusteringCoefficientList = [] for bestPopulation in bestPopulationList: for item in bestPopulation: # Fitness attachment = item[0][0,0]/networkSize