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:05 - loss: 0.6328 - tf.__operators__.getitem_loss: 0.7061 - tf.__operators__.getitem_1_loss: 0.5557 - tf.__operators__.getitem_2_loss: 0.7139 4/51 [=>............................] - ETA: 1s - loss: 0.3926 - tf.__operators__.getitem_loss: 0.5086 - tf.__operators__.getitem_1_loss: 0.2902 - tf.__operators__.getitem_2_loss: 0.4815 7/51 [===>..........................] - ETA: 0s - loss: 0.2571 - tf.__operators__.getitem_loss: 0.3485 - tf.__operators__.getitem_1_loss: 0.1846 - tf.__operators__.getitem_2_loss: 0.3108 10/51 [====>.........................] - ETA: 0s - loss: 0.2191 - tf.__operators__.getitem_loss: 0.2498 - tf.__operators__.getitem_1_loss: 0.2042 - tf.__operators__.getitem_2_loss: 0.2180 13/51 [======>.......................] - ETA: 0s - loss: 0.1913 - tf.__operators__.getitem_loss: 0.1988 - tf.__operators__.getitem_1_loss: 0.1983 - tf.__operators__.getitem_2_loss: 0.1698 16/51 [========>.....................] - ETA: 0s - loss: 0.1660 - tf.__operators__.getitem_loss: 0.1762 - tf.__operators__.getitem_1_loss: 0.1702 - tf.__operators__.getitem_2_loss: 0.1476 19/51 [==========>...................] - ETA: 0s - loss: 0.1495 - tf.__operators__.getitem_loss: 0.1685 - tf.__operators__.getitem_1_loss: 0.1445 - tf.__operators__.getitem_2_loss: 0.1405 22/51 [===========>..................] - ETA: 0s - loss: 0.1386 - tf.__operators__.getitem_loss: 0.1652 - tf.__operators__.getitem_1_loss: 0.1253 - tf.__operators__.getitem_2_loss: 0.1386 25/51 [=============>................] - ETA: 0s - loss: 0.1296 - tf.__operators__.getitem_loss: 0.1608 - tf.__operators__.getitem_1_loss: 0.1108 - tf.__operators__.getitem_2_loss: 0.1361 28/51 [===============>..............] - ETA: 0s - loss: 0.1214 - tf.__operators__.getitem_loss: 0.1537 - tf.__operators__.getitem_1_loss: 0.1003 - tf.__operators__.getitem_2_loss: 0.1313 31/51 [=================>............] - ETA: 0s - loss: 0.1143 - tf.__operators__.getitem_loss: 0.1448 - tf.__operators__.getitem_1_loss: 0.0938 - tf.__operators__.getitem_2_loss: 0.1248 34/51 [===================>..........] - ETA: 0s - loss: 0.1087 - tf.__operators__.getitem_loss: 0.1359 - tf.__operators__.getitem_1_loss: 0.0904 - tf.__operators__.getitem_2_loss: 0.1179 37/51 [====================>.........] - ETA: 0s - loss: 0.1040 - tf.__operators__.getitem_loss: 0.1281 - tf.__operators__.getitem_1_loss: 0.0879 - tf.__operators__.getitem_2_loss: 0.1120 40/51 [======================>.......] - ETA: 0s - loss: 0.0997 - tf.__operators__.getitem_loss: 0.1220 - tf.__operators__.getitem_1_loss: 0.0847 - tf.__operators__.getitem_2_loss: 0.1074 43/51 [========================>.....] - ETA: 0s - loss: 0.0959 - tf.__operators__.getitem_loss: 0.1177 - tf.__operators__.getitem_1_loss: 0.0807 - tf.__operators__.getitem_2_loss: 0.1043 46/51 [==========================>...] - ETA: 0s - loss: 0.0925 - tf.__operators__.getitem_loss: 0.1146 - tf.__operators__.getitem_1_loss: 0.0766 - tf.__operators__.getitem_2_loss: 0.1022 49/51 [===========================>..] - ETA: 0s - loss: 0.0896 - tf.__operators__.getitem_loss: 0.1121 - tf.__operators__.getitem_1_loss: 0.0729 - tf.__operators__.getitem_2_loss: 0.1005 51/51 [==============================] - 6s 49ms/step - loss: 0.0877 - tf.__operators__.getitem_loss: 0.1104 - tf.__operators__.getitem_1_loss: 0.0707 - tf.__operators__.getitem_2_loss: 0.0992 - val_loss: 0.0420 - val_tf.__operators__.getitem_loss: 0.0647 - val_tf.__operators__.getitem_1_loss: 0.0191 - val_tf.__operators__.getitem_2_loss: 0.0651 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 11ms/step In [8]: print("Reverse Prediction: {}\nReconstructed Values: {}, Forward Prediction: {}".format(ry, y, fy)) Reverse Prediction: [[0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188] [0.74567188]] Reconstructed Values: [[[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]] [[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]] [[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]] ... [[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]] [[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]] [[0.86373213] [0.94708711] [1.00604448] ... [0.98981457] [0.93391949] [0.85568408]]], Forward Prediction: [[0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171] [0.74485171]]