def reshape_dataset(dataset): print dataset.shape #You need fill as your program x, y = dataset.shape feature_data = dataset[:, :-1] temp_data = np.zeros((x, y - 1, y - 1)) input_data = np.zeros((x, y + 2, y + 2)) for i in xrange(x): for j in xrange(y - 1): right = feature_data[i, :j] left = feature_data[i, j:] temp_data[i, j] = np.concatenate((left, right)) input_data[:, 1:-2, 1:-2] = temp_data[:, :, :] input_data = input_data.reshape((x, y + 2, y + 2, 1)) output_data = dataset[:, -1].astype(int) output_data = dpm.num_to_one_hot(output_data, 9) print input_data.shape return input_data, output_data
def reshape_dataset(dataset, SPAN): input_data = np.zeros((dataset.shape[0], 32, 104, 2)) temp_data = np.reshape(dataset[:, :6200], (-1, 31, 100, 2)) input_data[:, :31, 2:102, 0] = temp_data[:, :, :, 0] # cause input size is 32 not 31 input_data[:, :31, 2:102, 1] = temp_data[:, :, :, 1] para_data = dataset[:, 6200:6241] output_data = dataset[:, 6240 + SPAN[0]].astype(int) output_data = dpm.num_to_one_hot(output_data, 3) return input_data, para_data, output_data
def reshape_dataset(dataset, SPAN): #You need fill as your program input_data = np.zeros((dataset.shape[0], 304, 48, 2)) real_C = np.reshape(dataset[:, :12000], (dataset.shape[0], 300, 40)) imag_C = np.reshape(dataset[:, 12000:24000], (dataset.shape[0], 300, 40)) input_data[:, 2:302, 4:44, 0] = real_C[:, :, :] input_data[:, 2:302, 4:44, 1] = imag_C[:, :, :] para_data = dataset[:, 24000:24041] #cause span begin with 1 not 0 output_data = dataset[:, 24061 + SPAN[0] - 1].astype(int) output_data = dpm.num_to_one_hot(output_data, 6) return input_data, para_data, output_data
def reshape_dataset(dataset): #You need fill as your program] #x is batch size y is 94 feature_data = dataset[:,:-1] temp_data = triple_size_data(feature_data) x, y, _, _ = temp_data.shape input_data = np.zeros((x, y+3, y+3, y)) input_data[:,1:-2,1:-2,:] = temp_data[:,:,:] output_data = dataset[:, -1].astype(int) output_data = dpm.num_to_one_hot(output_data, 9) return input_data, output_data
def reshape_dataset(dataset): #You need fill as your program] #feature data (x,35) feature_data = dataset[:, :-1] #temp data (x,35,35,35) temp_data = triple_size_data(feature_data) #x,y (batch,35) x, y, _, _ = temp_data.shape #input data (batch, 40,40,35) input_data = np.zeros((x, y + 5, y + 5, y)) input_data[:, 2:-3, 2:-3, :] = temp_data[:, :, :] output_data = dataset[:, -1].astype(int) output_data = dpm.num_to_one_hot(output_data, 2) return input_data, output_data