Пример #1
0
    target = dh.preProcessSamplesCyTOFData(target)

'''
Train the de-noising auto encoder.
'''
print('Train the de-noising auto encoder.')
start = tm.time()
DAE = dae.trainDAE(target, dataPath, refSampleInd, trainIndex,
                             relevantMarkers, mode, keepProb, denoise,
                             loadModel, dataSet[choice])
denoiseTarget = dae.predictDAE(target, DAE, denoise)

'''
Train the feed-forward classifier on (de-noised) target.
'''
denoiseTarget, preprocessor = dh.standard_scale(denoiseTarget,
                                                preprocessor = None)

if loadModel:
    from keras.models import load_model
    cellClassifier = load_model(os.path.join(io.DeepLearningRoot(),
                                'savemodels/' + dataSet[choice] +
                                '/cellClassifier.h5'))
else:
    print('Train the classifier on de-noised Target')
    cellClassifier = net.trainClassifier(denoiseTarget, mode, refSampleInd,
                                         hiddenLayersSizes,
                                         activation,
                                         l2_penalty,
                                         dataSet[choice])
end = tm.time()
print('Training time: ' + str(end - start))
Пример #2
0
75% of cells.
'''
print('Data set name: ', dataSet[choice])
for i in range(numSample[choice]):
    # Load sample.
    print('Load sample ', str(i + 1))
    sample = dh.loadDeepCyTOFData(dataPath,
                                  i + 1,
                                  range(relevantMarkers[choice]),
                                  'CSV',
                                  skip_header=1)

    # Pre-process sample.
    print('Pre-process sample ', str(i + 1))
    sample = dh.preProcessSamplesCyTOFData(sample)
    sample, preprocessor = dh.standard_scale(sample, preprocessor=None)

    # Split data into training and testing.
    print('Split data into training and testing.')
    trainSample, testSample = dh.splitData(sample, test_size=.75)

    # Train a feed-forward neural net classifier on the training data.
    print('Train a feed-forward neural net classifier on the training data.')
    classifier = net.trainClassifier(trainSample,
                                     dataSet[choice],
                                     i,
                                     hiddenLayersSizes,
                                     activation=activation,
                                     l2_penalty=l2_penalty)

    # Run the classifier on the testing data.