Пример #1
0
def test():
    data = []
    data.append([0, 0, 1, 1])
    data.append([0, 0, 1, 0.9])
    data.append([0, 0, 0.9, 0.9])
    data.append([0.8, 1, 0, 0])
    data.append([1, 1, 0.1, 0])
    data.append([1, 0.9, 0, 0.2])

    targets = []
    targets.append(0)
    targets.append(0)
    targets.append(0)
    targets.append(1)
    targets.append(1)
    targets.append(1)

    layers = [4, 2, 1]
    dnn = AutoEncoder(data,
                      data,
                      targets,
                      layers,
                      hidden_layer="TANH",
                      final_layer="TANH",
                      compression_epochs=50,
                      bias=True,
                      autoencoding_only=True)
    #dnn = DNNRegressor(data, targets, layers, hidden_layer="TanhLayer", final_layer="TanhLayer", compression_epochs=50, bias=True, autoencoding_only=False)
    dnn = dnn.fit()
    data.append([0.9, 0.8, 0, 0.1])
    print "\n-----"
    for d in data:
        print dnn.activate(d)
Пример #2
0
def test():
    data = []
    data.append([0,0,1,1])
    data.append([0,0,1,0.9])
    data.append([0,0,0.9,0.9])
    data.append([0.8,1,0,0])
    data.append([1,1,0.1,0])
    data.append([1,0.9,0,0.2])

    targets = []
    targets.append(0)
    targets.append(0)
    targets.append(0)
    targets.append(1)
    targets.append(1)
    targets.append(1)

    layers = [4,2,1]
    dnn = AutoEncoder(data, data, targets, layers, hidden_layer="TANH", final_layer="TANH", compression_epochs=50, bias=True, autoencoding_only=True)
    #dnn = DNNRegressor(data, targets, layers, hidden_layer="TanhLayer", final_layer="TanhLayer", compression_epochs=50, bias=True, autoencoding_only=False)
    dnn = dnn.fit()
    data.append([0.9, 0.8, 0, 0.1])
    print "\n-----"
    for d in data:
        print dnn.activate(d)
Пример #3
0
 def autoencode(self, data, targets, cv, epochs=1, new=True):
     if new:
         end = 1000
         autoencoder = AutoEncoder(
             data[:end],
             targets[:end],
             [1875, 900, 9],
             hidden_layer="SigmoidLayer",
             final_layer="SigmoidLayer",
             compression_epochs=epochs,
             bias=True,
             autoencoding_only=True,
         )
         autoencoder = autoencoder.fit()
         save(filename, autoencoder)
     else:
         autoencoder = load(filename)
     data = [autoencoder.activate(d) for d in data]
     cv = [autoencoder.activate(c) for c in cv]
     print data[0][:10]
     return data, cv