# y1=np.array(y1) # print(y1.shape) # Network Parameters n_hidden_1 = 30 # 1st layer num features n_hidden_2 = 20 # 2nd layer num features n_hidden_3 = 10 n_hidden_4 = 5 n_input = 90 if os.path.isdir(os.getcwd() + '/model'): shutil.rmtree(os.getcwd() + '/model') os.mkdir(os.getcwd() + '/model') for test_i in range(1, 18): #we must create a sesession for each of loc os.mkdir(os.getcwd() + '/model/Test' + str(test_i)) csi = np.squeeze(np.array(get_csi(test_i))) # create and train a graph for each point for k in range(16): # for each test we have 16 train point in sn2 os.mkdir(os.getcwd() + '/model/Test' + str(test_i) + '/' + str(k + 1)) # tf Graph input (only pictures) X = tf.placeholder("float", [None, n_input]) weights = { 'encoder_h1': tf.Variable(tf.random_normal([n_input, n_hidden_1]), name='w1'), 'encoder_h2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2]), name='w2'), 'encoder_h3': tf.Variable(tf.random_normal([n_hidden_2, n_hidden_3]), name='w3'), 'encoder_h4': tf.Variable(tf.random_normal([n_hidden_3, n_hidden_4]), name='w4'),
import numpy as np from get_v3 import get_csi import os import shutil if os.path.isdir(os.getcwd() + '/Models'): shutil.rmtree(os.getcwd() + '/Models') os.mkdir(os.getcwd() + '/Models') random_points = list( np.array([1, 2, 4, 6, 7, 8, 10, 12, 13, 14, 16, 17, 19]) - 1) for k in range(1, 14): csi = get_csi(k, random_points) csi = np.squeeze(csi) print(csi.shape) point1 = csi[0:20] point2 = csi[20:40] point3 = csi[40:60] point4 = csi[60:80] point5 = csi[80:100] point6 = csi[100:120] point7 = csi[120:140] point8 = csi[140:160] point9 = csi[160:180] point10 = csi[180:200] point11 = csi[200:220] point12 = csi[220:240]
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #from read_from_db import read_csi_from_db from get_v3 import get_csi import os import shutil if os.path.isdir(os.getcwd()+'/Models'): shutil.rmtree(os.getcwd()+'/Models') #print("1") os.mkdir(os.getcwd()+'/Models') for k in range(1,20): csi = get_csi(k) #360*1*90 csi = np.squeeze(csi) #360*90 20 packet from each of 18 Location -- point1=csi[0:20] point2=csi[20:40] point3=csi[40:60] point4=csi[60:80] point5=csi[80:100] point6=csi[100:120] point7=csi[120:140] point8=csi[140:160] point9=csi[160:180] point10=csi[180:200] point11=csi[200:220] point12=csi[220:240] point13=csi[240:260] point14=csi[260:280]
# Network Parameters n_hidden_1 = 30 # 1st layer num features n_hidden_2 = 20 # 2nd layer num features n_hidden_3 = 10 n_hidden_4 = 5 n_input = 90 if os.path.isdir(os.getcwd() + '/model'): shutil.rmtree(os.getcwd() + '/model') os.mkdir(os.getcwd() + '/model') for test_i in range(1, 17): #we must create a session for each of loc random_point = list( np.array([1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19]) - 1) os.mkdir(os.getcwd() + '/model/Test' + str(test_i)) csi = np.squeeze(np.array(get_csi(random_point[test_i - 1], random_point))) # create and train a graph for each point random_point.pop(test_i - 1) for k in range(len(random_point)): os.mkdir(os.getcwd() + '/model/Test' + str(test_i) + '/' + str(k + 1)) # tf Graph input (only pictures) X = tf.placeholder("float", [None, n_input]) weights = { 'encoder_h1': tf.Variable(tf.random_normal([n_input, n_hidden_1]), name='w1'), 'encoder_h2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2]), name='w2'), 'encoder_h3': tf.Variable(tf.random_normal([n_hidden_2, n_hidden_3]), name='w3'),
import tensorflow as tf import numpy as np # import matplotlib.pyplot as plt #from read_from_db import read_csi_from_db from get_v3 import get_csi import os import shutil if os.path.isdir(os.getcwd()+'/Models'): shutil.rmtree(os.getcwd()+'/Models') #print("1") os.mkdir(os.getcwd()+'/Models') for k in range(1,18): csi = get_csi(k) csi = np.squeeze(csi) # 320*90 --> [20*16,90] point1=csi[0:20] point2=csi[20:40] point3=csi[40:60] point4=csi[60:80] point5=csi[80:100] point6=csi[100:120] point7=csi[120:140] point8=csi[140:160] point9=csi[160:180] point10=csi[180:200] point11=csi[200:220] point12=csi[220:240] point13=csi[240:260] point14=csi[260:280]
#num_of_SPs=[6,10,14,17] num_of_SPs=17 for sp in [num_of_SPs]: total_elapsed_time=[] total_memory_used=[] total_memory_perc=[] random_list=random.sample(range(17), sp) if os.path.isdir(os.getcwd()+r'\Models'): shutil.rmtree(os.getcwd()+r'\Models') os.mkdir(os.getcwd()+r'\Models') for test_i in [random_list.index(random_list[-1])]: # we must create a session for each of loc --> model all other sps with one net!! csi = get_csi(random_list[test_i],random_list) csi = np.squeeze(csi) st = time.time() points=[] for t in range(sp): points.append(csi[t*20:(t+1)*20]) total=points # Parameters learning_rate = 0.01 training_epochs = 1000 display_step = 50 n_labels = sp-1 #
for sp in [6]: total_elapsed_time = [] total_memory_used = [] total_memory_perc = [] random_list = random.sample(range(19), sp) if os.path.isdir(os.getcwd() + r'\model'): shutil.rmtree(os.getcwd() + r'\model') os.mkdir(os.getcwd() + r'\model') os.mkdir(os.getcwd() + r'\model\-' + str(sp)) for test_i in range(len(random_list) - 1): #we must create a session for each of loc os.mkdir(os.getcwd() + r'\model\-' + str(sp) + r'\Test-' + str(test_i + 1)) csi = np.squeeze(np.array(get_csi(random_list[test_i], random_list))) # create and train a graph for each point st = time.time() # tf Graph input (only pictures) X = tf.placeholder("float", [None, n_input]) weights = { 'encoder_h1': tf.Variable(tf.random_normal([n_input, n_hidden_1]), name='w1'), 'encoder_h2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2]), name='w2'), 'encoder_h3': tf.Variable(tf.random_normal([n_hidden_2, n_hidden_3]), name='w3'), 'encoder_h4': tf.Variable(tf.random_normal([n_hidden_3, n_hidden_4]), name='w4'), 'decoder_h1':