先前的部分介绍了监督Deep Learning内容,Deep Learning 也可以用作非监督特征学习,尤其是在非线性降维方面。
Deep Autoencoders
Deep Autoencoders的原理可以看UFLDL的教程
例子:Anomaly Detection
#Import ECG train and test data into the H2O cluster
from h2o.estimators.deeplearning import H2OAutoEncoderEstimator
import h2o
h2o.init()
train_ecg = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/anomaly/ecg_discord_train.csv")
test_ecg = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/anomaly/ecg_discord_test.csv")
train_ecg.describe()
test_ecg.describe()
#Train deep autoencoder learning model on "normal"
# training data, y ignored
anomaly_model = H2OAutoEncoderEstimator(activation="Tanh",
hidden=[50,50,50],
sparse=True,
l1=1e-4,
epochs=100)
anomaly_model.train(x=train_ecg.names,training_frame=train_ecg)
# Compute reconstruction error with the Anomaly
# detection app (MSE between output and input layers)
recon_error = anomaly_model.anomaly(test_ecg)
print 'recon_error:',recon_error
# Testing = Reconstructing the test dataset
test_recon = anomaly_model.predict(test_ecg)
print 'test_recon:',test_recon