# 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!")
#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!")
                                                                               noOfBest=noOfBest,
                                                                               resTopology=utilityGA.Topology.SmallWorldGraphs,
                                                                               size=networkSize,
                                                                               popSize=populationSize,
                                                                               maxGeneration=noOfGenerations)

predictedOutputData = minMax.inverse_transform(predictedOutputData)

#Plotting of the prediction output and error
outputFolderName = "Outputs/Small_World_Graphs" + 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.SmallWorldGraphs, networkSize)

# Load the best population
print(utilityGA.loadBestPopulation(popFileName))

endTime = time()
run_time = endTime - startTime
print("The run time:"+str(run_time))
print("Done!")
predictedOutputData = minMax.inverse_transform(predictedOutputData)

#Plotting of the prediction output and error
outputFolderName = "Outputs/Small_World_Graphs" + 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.SmallWorldGraphs,
                                      networkSize)

# Load the best population
print(utilityGA.loadBestPopulation(popFileName))

endTime = time()
run_time = endTime - startTime
print("The run time:" + str(run_time))
print("Done!")
Exemplo n.º 5
0
                                                                               noOfBest=noOfBest,
                                                                               resTopology=utilityGA.Topology.ErdosRenyi,
                                                                               size=networkSize,
                                                                               popSize=populationSize,
                                                                               maxGeneration=noOfGenerations)

predictedOutputData = minMax.inverse_transform(predictedOutputData)

#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!")
predictedOutputData = minMax.inverse_transform(predictedOutputData)

#Plotting of the prediction output and error
outputFolderName = "Outputs/Scale_Free_Networks_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.ScaleFreeNetworks,
                                      networkSize)

# Load the best population
print(utilityGA.loadBestPopulation(popFileName))

endTime = time()
run_time = endTime - startTime
print("The run time:" + str(run_time))
print("Done!")