Orion
path: orion.primitives.aer.AER
orion.primitives.aer.AER
description: this an autoencoder-based model capable of creating both prediction-based and reconstruction-based anomaly scores.
see json.
argument
type
description
parameters
X
numpy.ndarray
n-dimensional array containing the input sequences for the model
y
n-dimensional array containing the target sequences we want to reconstruct. Typically y is a signal from a selected set of channels from X.
hyperparameters
epochs
int
number of epochs to train the model. An epoch is an iteration over the entire X data provided
input_shape
tuple
tuple denoting the shape of an input sample
optimizer
str
string (name of optimizer) or optimizer instance. Default is keras.optimizers.Adam
keras.optimizers.Adam
learning_rate
float
float denoting the learning rate of the optimizer. Default is 0.001
batch_size
number of samples per gradient update. Default is 64
layers_encoder
list
list containing layers of encoder
layers_generator
list containing layers of generator
output
ry_hat
n-dimensional array containing the regression for each input sequence (reverse)
y_hat
n-dimensional array containing the reconstructions for each input sequence
fy_hat
n-dimensional array containing the regression for each input sequence (forward)
In [1]: import numpy as np In [2]: from mlstars import load_primitive In [3]: X = np.ones((64, 100, 1)) In [4]: y = X[:,:, [0]] # signal to reconstruct from X (channel 0) In [5]: primitive = load_primitive('orion.primitives.aer.AER', ...: arguments={"X": X, "y": y, "epochs": 1, "batch_size": 1}) ...: In [6]: primitive.fit() 1/51 [..............................] - ETA: 3:03 - loss: 1.1469 - tf.__operators__.getitem_loss: 1.0879 - tf.__operators__.getitem_1_loss: 1.1891 - tf.__operators__.getitem_2_loss: 1.1215 4/51 [=>............................] - ETA: 1s - loss: 0.8234 - tf.__operators__.getitem_loss: 0.8448 - tf.__operators__.getitem_1_loss: 0.7950 - tf.__operators__.getitem_2_loss: 0.8588 7/51 [===>..........................] - ETA: 1s - loss: 0.5901 - tf.__operators__.getitem_loss: 0.6555 - tf.__operators__.getitem_1_loss: 0.5283 - tf.__operators__.getitem_2_loss: 0.6482 10/51 [====>.........................] - ETA: 0s - loss: 0.4355 - tf.__operators__.getitem_loss: 0.5063 - tf.__operators__.getitem_1_loss: 0.3755 - tf.__operators__.getitem_2_loss: 0.4846 13/51 [======>.......................] - ETA: 0s - loss: 0.3566 - tf.__operators__.getitem_loss: 0.3975 - tf.__operators__.getitem_1_loss: 0.3274 - tf.__operators__.getitem_2_loss: 0.3741 16/51 [========>.....................] - ETA: 0s - loss: 0.3122 - tf.__operators__.getitem_loss: 0.3255 - tf.__operators__.getitem_1_loss: 0.3097 - tf.__operators__.getitem_2_loss: 0.3040 19/51 [==========>...................] - ETA: 0s - loss: 0.2746 - tf.__operators__.getitem_loss: 0.2788 - tf.__operators__.getitem_1_loss: 0.2808 - tf.__operators__.getitem_2_loss: 0.2582 22/51 [===========>..................] - ETA: 0s - loss: 0.2437 - tf.__operators__.getitem_loss: 0.2493 - tf.__operators__.getitem_1_loss: 0.2477 - tf.__operators__.getitem_2_loss: 0.2300 25/51 [=============>................] - ETA: 0s - loss: 0.2206 - tf.__operators__.getitem_loss: 0.2308 - tf.__operators__.getitem_1_loss: 0.2189 - tf.__operators__.getitem_2_loss: 0.2138 28/51 [===============>..............] - ETA: 0s - loss: 0.2032 - tf.__operators__.getitem_loss: 0.2177 - tf.__operators__.getitem_1_loss: 0.1958 - tf.__operators__.getitem_2_loss: 0.2036 31/51 [=================>............] - ETA: 0s - loss: 0.1890 - tf.__operators__.getitem_loss: 0.2065 - tf.__operators__.getitem_1_loss: 0.1771 - tf.__operators__.getitem_2_loss: 0.1952 34/51 [===================>..........] - ETA: 0s - loss: 0.1766 - tf.__operators__.getitem_loss: 0.1957 - tf.__operators__.getitem_1_loss: 0.1621 - tf.__operators__.getitem_2_loss: 0.1867 37/51 [====================>.........] - ETA: 0s - loss: 0.1658 - tf.__operators__.getitem_loss: 0.1848 - tf.__operators__.getitem_1_loss: 0.1504 - tf.__operators__.getitem_2_loss: 0.1777 40/51 [======================>.......] - ETA: 0s - loss: 0.1565 - tf.__operators__.getitem_loss: 0.1742 - tf.__operators__.getitem_1_loss: 0.1417 - tf.__operators__.getitem_2_loss: 0.1686 43/51 [========================>.....] - ETA: 0s - loss: 0.1486 - tf.__operators__.getitem_loss: 0.1645 - tf.__operators__.getitem_1_loss: 0.1350 - tf.__operators__.getitem_2_loss: 0.1601 46/51 [==========================>...] - ETA: 0s - loss: 0.1417 - tf.__operators__.getitem_loss: 0.1559 - tf.__operators__.getitem_1_loss: 0.1293 - tf.__operators__.getitem_2_loss: 0.1525 49/51 [===========================>..] - ETA: 0s - loss: 0.1355 - tf.__operators__.getitem_loss: 0.1487 - tf.__operators__.getitem_1_loss: 0.1237 - tf.__operators__.getitem_2_loss: 0.1461 51/51 [==============================] - 6s 49ms/step - loss: 0.1318 - tf.__operators__.getitem_loss: 0.1446 - tf.__operators__.getitem_1_loss: 0.1199 - tf.__operators__.getitem_2_loss: 0.1426 - val_loss: 0.0385 - val_tf.__operators__.getitem_loss: 0.0482 - val_tf.__operators__.getitem_1_loss: 0.0235 - val_tf.__operators__.getitem_2_loss: 0.0588 In [7]: ry, y, fy = primitive.produce(X=X) 1/2 [==============>...............] - ETA: 0s 2/2 [==============================] - 0s 10ms/step 1/2 [==============>...............] - ETA: 0s 2/2 [==============================] - 0s 12ms/step In [8]: print("Reverse Prediction: {}\nReconstructed Values: {}, Forward Prediction: {}".format(ry, y, fy)) Reverse Prediction: [[0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486] [0.78045486]] Reconstructed Values: [[[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]] [[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]] [[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]] ... [[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]] [[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]] [[0.88509127] [0.96182459] [1.01740248] ... [1.05021083] [0.99105823] [0.89935777]]], Forward Prediction: [[0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309] [0.75756309]]