beta_Val[j, 0], beta_Val[j][1] + ans[0], beta_Val[j][2] + ans[1], beta_Val[j][3] + ans[2], beta_Val[j + 1][4] ] sim_net2 = np.append(sim_net2, [ansK], axis=0) sim_net2 = np.append(sim_net2, [beta_Val[12]], axis=0) for j in xrange(12, 23): ans = network_2.activate((beta_Val[j])) ansK = [ beta_Val[j, 0], beta_Val[j][1] + ans[0], beta_Val[j][2] + ans[1], beta_Val[j][3] + ans[2], beta_Val[j + 1][4] ] sim_net2 = np.append(sim_net2, [ansK], axis=0) #denormalize and rescale to real size sim_deNorm2 = np.column_stack((de_normalizer(sim_net2[:, 0], theta_Val[:, 0]), de_normalizer(sim_net2[:, 1], theta_Val[:, 1]), de_normalizer(sim_net2[:, 2], theta_Val[:, 2]), de_normalizer(sim_net2[:, 3], theta_Val[:, 3]), de_normalizer(sim_net2[:, 4], theta_Val[:, 4]))) temp2 = pd.DataFrame(sim_net2, columns=lista_col3) temp2a = pd.DataFrame(sim_deNorm2, columns=lista_col3) beta = pd.concat([beta, temp2], axis=1, keys=['Experimental', 'Simulated']) theta = pd.concat([theta, temp2a], axis=1, keys=['Experimental', 'Simulated']) #save beta.to_csv(save_fold + 'Lutein_NN_Type2H1_CrossValNew_LessNoise2_ExpTraj.csv') theta.to_csv(save_fold + 'Lutein_NN_Type2H1_CrossValNew_LessNoise2_ExpTraj_Rescale.csv') #overwrite
] sim_net2 = np.append(sim_net2, [ansK], axis=0) sim_net2 = np.append(sim_net2, [beta_Val[12]], axis=0) for j in xrange(12, 23): ans = network_2.activate((beta_Val[j])) ansK = [ beta_Val[j, 0], beta_Val[j][1] + ans[0], beta_Val[j][2] + ans[1], beta_Val[j][3] + ans[2], beta_Val[j + 1][4] ] sim_net2 = np.append(sim_net2, [ansK], axis=0) #denormalize and rescale to real size sim_deNorm2 = np.column_stack( (de_standardizer( de_normalizer(sim_net2[:, 0], standardizer(theta_Val[:, 0])), theta_Val[:, 0]), de_standardizer( de_normalizer(sim_net2[:, 1], standardizer(theta_Val[:, 1])), theta_Val[:, 1]), de_standardizer( de_normalizer(sim_net2[:, 2], standardizer(theta_Val[:, 2])), theta_Val[:, 2]), de_standardizer( de_normalizer(sim_net2[:, 3], standardizer(theta_Val[:, 3])), theta_Val[:, 3]), de_standardizer( de_normalizer(sim_net2[:, 4], standardizer(theta_Val[:, 4])), theta_Val[:, 4]))) temp2 = pd.DataFrame(sim_net2, columns=lista_col3)
#denormalize and rescale to real size #print 'sim ', sim_net2[0,:] #print ' iota', iota[0,:] #print 'theta', theta_Val[0,:] #print 'arr temp', arr_temp[0,:] #print de_normalizer(sim_net2[:,3],standardizer(iota[:,3])) #print de_standardizer(de_normalizer(sim_net2[:,3],standardizer(iota[:,3])),iota[:,3]) #print iota[:,3] #print standardizer(iota[:,3]) #print normalizer(standardizer(iota[:,3])) #sys.exit() sim_deNorm2 = np.column_stack( (sim_net2[:, 0], de_standardizer(de_normalizer(sim_net2[:, 1], standardizer(iota[:, 1])), iota[:, 1]), de_standardizer(de_normalizer(sim_net2[:, 2], standardizer(iota[:, 2])), iota[:, 2]), de_standardizer(de_normalizer(sim_net2[:, 3], standardizer(iota[:, 3])), iota[:, 3]), de_standardizer(de_normalizer(sim_net2[:, 4], standardizer(iota[:, 4])), iota[:, 4]))) #de_standardizer(de_normalizer(arr_tempA[:,2],standardizer(iota[:,2])),iota[:,2]) temp2 = pd.DataFrame(sim_net2, columns=lista_col3) temp2a = pd.DataFrame(sim_deNorm2, columns=lista_col3) beta = pd.concat([beta, temp2], axis=1, keys=['Experimental', 'Simulated']) theta = pd.concat([theta, temp2a], axis=1, keys=['Experimental', 'Simulated'])
for j in xrange(12, 23): ans = network_2.activate((beta_Val[j])) ansK = [ beta_Val[j, 0], beta_Val[j][1] + ans[0], beta_Val[j][2] + ans[1], beta_Val[j][3] + ans[2], beta_Val[j + 1][4] ] sim_net2 = np.append(sim_net2, [ansK], axis=0) #denormalize and rescale to real size #print theta_Val #print beta_Val #sys.exit() dataSet1 = np.column_stack( (sim_net2[:sLht, 0], de_standardizer( de_normalizer(sim_net2[:sLht, 1], standardizer(arr_temp[:sLht, 1])), arr_temp[:sLht, 1]), de_standardizer( de_normalizer(sim_net2[:sLht, 2], standardizer(arr_temp[:sLht, 2])), arr_temp[:sLht, 2]), de_standardizer( de_normalizer(sim_net2[:sLht, 3], standardizer(arr_temp[:sLht, 3])), arr_temp[:sLht, 3]), de_standardizer( de_normalizer(sim_net2[:sLht, 4], standardizer(arr_temp[:sLht, 4])), arr_temp[:sLht, 4]))) dataSet2 = np.column_stack( (sim_net2[sLht:, 0], de_standardizer( de_normalizer(sim_net2[sLht:, 1], standardizer(arr_temp[sLht:, 1])),
#simulation for Network 2, 1 Hidden. for j in xrange(11): ans=network_2.activate((beta_Val[j])) ansK=[beta_Val[j,0],beta_Val[j][1]+ans[0],beta_Val[j][2]+ans[1],beta_Val[j][3]+ans[2],beta_Val[j+1][4]] sim_net2=np.append(sim_net2,[ansK],axis=0) sim_net2=np.append(sim_net2,[beta_Val[12]],axis=0) for j in xrange(12,23): ans=network_2.activate((beta_Val[j])) ansK=[beta_Val[j,0],beta_Val[j][1]+ans[0],beta_Val[j][2]+ans[1],beta_Val[j][3]+ans[2],beta_Val[j+1][4]] sim_net2=np.append(sim_net2,[ansK],axis=0) #denormalize and rescale to real size print sim_net2[:,3] print standardizer(theta_Val[:,3]) print de_normalizer(sim_net2[:,3],standardizer(theta_Val[:,3])) print de_standardizer(de_normalizer(sim_net2[:,3],standardizer(theta_Val[:,3])),theta_Val[:,3]) print theta_Val[:,3] #sys.exit() sim_deNorm2=np.column_stack(( sim_net2[:,0] ,de_standardizer(de_normalizer(sim_net2[:,1],standardizer(theta_Val[:,1])),theta_Val[:,1]) ,de_standardizer(de_normalizer(sim_net2[:,2],standardizer(theta_Val[:,2])),theta_Val[:,2]) ,de_standardizer(de_normalizer(sim_net2[:,3],standardizer(theta_Val[:,3])),theta_Val[:,3]) ,de_standardizer(de_normalizer(sim_net2[:,4],standardizer(theta_Val[:,4])),theta_Val[:,4]))) #de_standardizer(de_normalizer(arr_tempA[:,2],standardizer(arr_temp[:,2])),arr_temp[:,2]) temp2=pd.DataFrame(sim_net2,columns=lista_col3) temp2a=pd.DataFrame(sim_deNorm2,columns=lista_col3)