p2d1Path = os.path.join(io.DeepLearningRoot(),'Data/Person2Day1_baseline.csv') p2d2Path = os.path.join(io.DeepLearningRoot(),'Data/Person2Day2_baseline.csv') p1Dae = load_model(os.path.join(io.DeepLearningRoot(),'savedModels/person1_baseline_DAE.h5')) p2Dae = load_model(os.path.join(io.DeepLearningRoot(),'savedModels/person2_baseline_DAE.h5')) p1d1 = genfromtxt(p1d1Path, delimiter=',', skip_header=0) p1d2 = genfromtxt(p1d2Path, delimiter=',', skip_header=0) p2d1 = genfromtxt(p2d1Path, delimiter=',', skip_header=0) p2d2 = genfromtxt(p2d2Path, delimiter=',', skip_header=0) # pre-process data: log transformation, a standard practice with CyTOF data p1d1 = dh.preProcessCytofData(p1d1) p1d2 = dh.preProcessCytofData(p1d2) p2d1 = dh.preProcessCytofData(p2d1) p2d2 = dh.preProcessCytofData(p2d2) if denoise: p1d1 = p1Dae.predict(p1d1) p1d2 = p1Dae.predict(p1d2) p2d1 = p2Dae.predict(p2d1) p2d2 = p2Dae.predict(p2d2) # rescale source to have zero mean and unit variance # apply same transformation to the target p1d1_pp = prep.StandardScaler().fit(p1d1) p1d2_pp = prep.StandardScaler().fit(p1d2) p2d1_pp = prep.StandardScaler().fit(p2d1)
if data == 'person1_3month': sourcePath = os.path.join(io.DeepLearningRoot(), 'Data/Person1Day1_3month.csv') targetPath = os.path.join(io.DeepLearningRoot(), 'Data/Person1Day2_3month.csv') if data == 'person2_3month': sourcePath = os.path.join(io.DeepLearningRoot(), 'Data/Person2Day1_3month.csv') targetPath = os.path.join(io.DeepLearningRoot(), 'Data/Person2Day2_3month.csv') source = genfromtxt(sourcePath, delimiter=',', skip_header=0) target = genfromtxt(targetPath, delimiter=',', skip_header=0) # pre-process data: log transformation, a standard practice with CyTOF data target = dh.preProcessCytofData(target) source = dh.preProcessCytofData(source) numZerosOK = 1 toKeepS = np.sum((source == 0), axis=1) <= numZerosOK print(np.sum(toKeepS)) toKeepT = np.sum((target == 0), axis=1) <= numZerosOK print(np.sum(toKeepT)) inputDim = target.shape[1] if denoise: trainTarget_ae = np.concatenate([source[toKeepS], target[toKeepT]], axis=0) np.random.shuffle(trainTarget_ae) trainData_ae = trainTarget_ae * np.random.binomial( n=1, p=keepProb, size=trainTarget_ae.shape)
'Data/Person2Day2_3month.csv') sourceLabelPath = os.path.join(io.DeepLearningRoot(), 'Data/Person2Day1_3month_label.csv') targetLabelPath = os.path.join(io.DeepLearningRoot(), 'Data/Person2Day2_3month_label.csv') autoencoder2 = load_model( os.path.join(io.DeepLearningRoot(), 'savedModels/person2_3month_DAE.h5')) source2 = genfromtxt(sourcePath, delimiter=',', skip_header=0) target2 = genfromtxt(targetPath, delimiter=',', skip_header=0) sourceLabels2 = genfromtxt(sourceLabelPath, delimiter=',', skip_header=0) targetLabels2 = genfromtxt(targetLabelPath, delimiter=',', skip_header=0) # pre-process data: log transformation, a standard practice with CyTOF data target1 = dh.preProcessCytofData(target1) source1 = dh.preProcessCytofData(source1) target2 = dh.preProcessCytofData(target2) source2 = dh.preProcessCytofData(source2) if denoise: source1 = autoencoder1.predict(source1) target1 = autoencoder1.predict(target1) source2 = autoencoder2.predict(source2) target2 = autoencoder2.predict(target2) # rescale source to have zero mean and unit variance # apply same transformation to the target preprocessor1 = prep.StandardScaler().fit(source1) source1 = preprocessor1.transform(source1) target1 = preprocessor1.transform(target1)