def plotHistogram(arrayValues, bins, ranges, fileName, title, subTitle, xAxisText, yAxisText, seriesName): hist, edges = np.histogram(a=arrayValues, bins=bins, range=ranges) histPlot = columnPlot.ErrorPlot(fileName, title, subTitle, xAxisText, yAxisText) # Form the range of the bins xAxisData = [] prev = edges[0] for i in range(1, edges.shape[0]): current = edges[i] xAxis = str(prev) + "-" + str(current) xAxisData.append(xAxis) prev = current xAxisData = np.array(xAxisData) histPlot.setXAxis(xAxisData) histPlot.setYAxis(seriesName, hist) histPlot.createOutput()
# Get the number of minibatches n_minibatches = data_sets.train.num_minibatches(batch_size) # # Plotting Setup # # Allow interactvie plotting plt.allow_plot() # Since we can't plot all the images in a batch, we pick some indices # that we use throughout the training train_recon_indices = choice(range(batch_size), 5, replace=False) valid_recon_indices = choice(range(data_sets.validation.num_examples), 5, replace=False) recept_indices = choice(range(n_hid), 20, replace=False) # Initialize the plots error_plot = ErrorPlot(1) recon_valid_plot = ReconstructionPlot(2) recept_fields_plot = ReceptiveFieldsPlot(3, width=5, height=4) activation_plot = ActivationPlot(4) # # Training # # K Step Contrasting Divergence. for i_epoch in range(n_epochs): train_err = 0.0 # Step 4
error = errorFunction.compute(actualData.reshape(1, horizon), deScaled.reshape(1, horizon)) regressionError.append(error) xAxisError.append("Depth_" + str(depth)) # Plotting of the actual and prediction output outputFolderName = "Outputs/Output" + str( datetime.now()) + "_depth_comparison_" + "_horizon_" + str(horizon) os.mkdir(outputFolderName) outplot = outTimePlot.OutputTimeSeriesPlot( outputFolderName + "/Prediction.html", "Comparison of prediction outputs", "with varying depths", "Likes Count") outplot.setSeries('Actual Output', np.array(xAxis), actualData) for depth in depthList: seriesName = 'Predicted_Output_depth' + str(depth) predicted = predictedDict[str(depth)] outplot.setSeries(seriesName, np.array(xAxis), predicted) outplot.createOutput() #Plotting of regression errPlot = errorPlot.ErrorPlot(outputFolderName + "/Regression_Error.html", "Comparison of regression error", "with varying depths", "ESN Configuration", "Total Error") #X-axis errPlot.setXAxis(np.array(xAxisError)) #Series data errPlot.setYAxis('Total Regression Error', np.array(regressionError)) errPlot.createOutput()
testingPredictedOutputData) actual = minMax.inverse_transform(testActualOutputData) standardError = errorFunction.compute( actual.reshape((actual.shape[0], 1)), testPredictedOutputDataStandard.reshape( (testPredictedOutputDataStandard.shape[0], 1))) testActualOutputData = minMax.inverse_transform(testActualOutputData[:nTesting, 0]) #Plotting of the prediction output and error outplot = outputPlot.OutputPlot( "Outputs/Prediction.html", "Darwin Sea Level Pressure Prediction", "Comparison of Random Graph Topolgies - Standard Vs Erdos", "Time", "Sea Level Pressure") outplot.setXSeries(np.arange(1, nTesting + 1)) outplot.setYSeries('Actual Output', testActualOutputData) outplot.setYSeries('Predicted Output_standard_ESN_with_parameters_tuned', testPredictedOutputDataStandard) outplot.setYSeries('Predicted Output_Erdoys_ESN_with_parameters_tuned', testPredictedOutputDataErdos) outplot.createOutput() #Plotting of regression error errPlot = errorPlot.ErrorPlot("Outputs/RegressionError.html", "Comparison of standard vs deterministic", "with parameters tuner", "ESN Configuration", "Total Error") errPlot.setXAxis(np.array(['Standard', 'Erdos Renyi'])) errPlot.setYAxis('RMSE', np.array([standardError, erdosError])) errPlot.createOutput()
testActualOutputData.reshape((testActualOutputData.shape[0], 1)), testPredictedOutputData.reshape( (testPredictedOutputData.shape[0], 1)))) #De-normalize testActualOutputData = minMax.inverse_transform(testActualOutputData[:nTesting, 0]) #Plotting of the prediction output and error outplot = outputPlot.OutputPlot("Outputs/Prediction.html", "Darwin Sea Level Pressure Prediction", "Deterministic echo state networks", "Time", "Sea Level Pressure") outplot.setXSeries(np.arange(1, nTesting + 1)) outplot.setYSeries('Actual Output', testActualOutputData) for i in range(len(topologyObjects)): seriesName = 'Predicted Output_' + topologyNames[i] seriesData = topologyTestOutput[i] outplot.setYSeries(seriesName, seriesData) outplot.createOutput() #Plotting of regression error topologyNames.append('Standard') errPlot = errorPlot.ErrorPlot("Outputs/RegressionError.html", "Deterministic echo state networks", "with different topologies", "Topology", "Total Error") errPlot.setXAxis(np.array(topologyNames)) errPlot.setYAxis('RMSE', np.array(topologyError)) errPlot.createOutput()
outplot = outputPlot.OutputPlot( outputFolderName + "/Prediction.html", "Darwin Sea Level Pressure Prediction", "Comparison of Random Graph Topolgies - Standard Vs Erdos", "Time", "Sea Level Pressure") outplot.setXSeries(np.arange(1, nTesting + 1)) outplot.setYSeries('Actual Output', testActualOutputData) outplot.setYSeries('Predicted Output_standard_ESN_with_all_parameters_tuned', testPredictedOutputDataStandard) outplot.setYSeries('Predicted Output_Erdoys_ESN_with_parameters_tuned', testPredictedOutputDataErdos) outplot.setYSeries('Predicted Output_Small World_ESN_with_parameters_tuned', testPredictedOutputDataSmallWorld) outplot.setYSeries('Predicted Output_Scale_Free_with_parameters_tuned', testPredictedOutputDataScaleFree) outplot.createOutput() #Plotting of regression error errPlot = errorPlot.ErrorPlot(outputFolderName + "/RegressionError.html", "Comparison of different graph topologies", "with parameters tuner", "ESN Configuration", "Total Error") errPlot.setXAxis( np.array( ['Standard', 'Erdos Renyi', 'Small World Graph', 'Scale Free Network'])) errPlot.setYAxis( 'RMSE', np.array([standardError, erdosError, smallWorldError, scaleFreeError])) errPlot.createOutput()