data = { 'value': value, 'prediction_training': training_colomn, 'label': label } colomn_arrangement = ['value', 'prediction_training', 'label'] for i in range(no_of_prediction_points): prediction[i] = np.append(training, prediction[i]) data['prediction_' + str(i)] = prediction[i] colomn_arrangement.append('prediction_' + str(i)) dataframe_out = pandas.DataFrame(data, index=timestamp) dataframe_out.index.name = "timestamp" dataframe_out = dataframe_out[colomn_arrangement] out_file = helpers.get_result_file_name(f, csv_output_directory, m) dataframe_out.to_csv(out_file) testing_value = value[testing_start:] mse = helpers.MSE_multipoint(testing_value, testing_prediction, no_of_prediction_points) output_files.append( helpers.get_result_dump_name(out_file) + "," + str(mse) + "," + params) helpers.dump_results(output_files, csv_output_directory, m) print("##### [" + m + "]" + str(count) + " CSV input File processed #####") count += 1 print("##### " + m + " done ! #####") print("All Done !")
testing_start = int(training_ratio*len(value)) training = np.ones(testing_start) testing = np.zeros(len(value)-testing_start) training_colomn = np.append(training,testing) try : label = np.array(dataframe_expect['label']) except KeyError: print "Warnning :["+f+"] No `label` colomn found data set without labels !. Assumes there are no anomolies" label = np.zeros(len(value)) testing_prediction = prediction prediction = np.append(training, prediction) data = {'prediction':prediction, 'value':value, 'prediction_training':training_colomn, 'label':label } dataframe_out = pandas.DataFrame(data, index=timestamp) dataframe_out.index.name = "timestamp" dataframe_out = dataframe_out[['value','prediction_training','prediction','label']] out_file = helpers.get_result_file_name(f, csv_output_directory,m) dataframe_out.to_csv(out_file) testing_value = value[testing_start:] mse = helpers.MSE(testing_value, testing_prediction) output_files.append( helpers.get_result_dump_name(out_file) +","+ str(mse)+","+params ) helpers.dump_results(output_files, csv_output_directory,m) print("##### ["+m+"]"+ str(count) + " CSV input File processed #####") count += 1 print("##### " + m + " done ! #####") print("All Done !")