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:06 - loss: 0.9387 - tf.__operators__.getitem_loss: 1.0812 - tf.__operators__.getitem_1_loss: 0.9278 - tf.__operators__.getitem_2_loss: 0.8181 4/51 [=>............................] - ETA: 1s - loss: 0.6234 - tf.__operators__.getitem_loss: 0.8419 - tf.__operators__.getitem_1_loss: 0.5516 - tf.__operators__.getitem_2_loss: 0.5486 7/51 [===>..........................] - ETA: 0s - loss: 0.4156 - tf.__operators__.getitem_loss: 0.6432 - tf.__operators__.getitem_1_loss: 0.3328 - tf.__operators__.getitem_2_loss: 0.3537 10/51 [====>.........................] - ETA: 0s - loss: 0.3250 - tf.__operators__.getitem_loss: 0.4905 - tf.__operators__.getitem_1_loss: 0.2797 - tf.__operators__.getitem_2_loss: 0.2501 13/51 [======>.......................] - ETA: 0s - loss: 0.2843 - tf.__operators__.getitem_loss: 0.3926 - tf.__operators__.getitem_1_loss: 0.2741 - tf.__operators__.getitem_2_loss: 0.1963 16/51 [========>.....................] - ETA: 0s - loss: 0.2472 - tf.__operators__.getitem_loss: 0.3354 - tf.__operators__.getitem_1_loss: 0.2468 - tf.__operators__.getitem_2_loss: 0.1599 19/51 [==========>...................] - ETA: 0s - loss: 0.2170 - tf.__operators__.getitem_loss: 0.3034 - tf.__operators__.getitem_1_loss: 0.2125 - tf.__operators__.getitem_2_loss: 0.1395 22/51 [===========>..................] - ETA: 0s - loss: 0.1959 - tf.__operators__.getitem_loss: 0.2842 - tf.__operators__.getitem_1_loss: 0.1842 - tf.__operators__.getitem_2_loss: 0.1311 25/51 [=============>................] - ETA: 0s - loss: 0.1804 - tf.__operators__.getitem_loss: 0.2693 - tf.__operators__.getitem_1_loss: 0.1624 - tf.__operators__.getitem_2_loss: 0.1276 28/51 [===============>..............] - ETA: 0s - loss: 0.1674 - tf.__operators__.getitem_loss: 0.2543 - tf.__operators__.getitem_1_loss: 0.1455 - tf.__operators__.getitem_2_loss: 0.1242 31/51 [=================>............] - ETA: 0s - loss: 0.1558 - tf.__operators__.getitem_loss: 0.2383 - tf.__operators__.getitem_1_loss: 0.1328 - tf.__operators__.getitem_2_loss: 0.1193 34/51 [===================>..........] - ETA: 0s - loss: 0.1461 - tf.__operators__.getitem_loss: 0.2222 - tf.__operators__.getitem_1_loss: 0.1243 - tf.__operators__.getitem_2_loss: 0.1134 37/51 [====================>.........] - ETA: 0s - loss: 0.1381 - tf.__operators__.getitem_loss: 0.2073 - tf.__operators__.getitem_1_loss: 0.1188 - tf.__operators__.getitem_2_loss: 0.1075 40/51 [======================>.......] - ETA: 0s - loss: 0.1313 - tf.__operators__.getitem_loss: 0.1944 - tf.__operators__.getitem_1_loss: 0.1140 - tf.__operators__.getitem_2_loss: 0.1025 43/51 [========================>.....] - ETA: 0s - loss: 0.1251 - tf.__operators__.getitem_loss: 0.1839 - tf.__operators__.getitem_1_loss: 0.1089 - tf.__operators__.getitem_2_loss: 0.0989 46/51 [==========================>...] - ETA: 0s - loss: 0.1197 - tf.__operators__.getitem_loss: 0.1755 - tf.__operators__.getitem_1_loss: 0.1033 - tf.__operators__.getitem_2_loss: 0.0965 49/51 [===========================>..] - ETA: 0s - loss: 0.1149 - tf.__operators__.getitem_loss: 0.1687 - tf.__operators__.getitem_1_loss: 0.0979 - tf.__operators__.getitem_2_loss: 0.0949 51/51 [==============================] - 6s 49ms/step - loss: 0.1120 - tf.__operators__.getitem_loss: 0.1646 - tf.__operators__.getitem_1_loss: 0.0946 - tf.__operators__.getitem_2_loss: 0.0940 - val_loss: 0.0402 - val_tf.__operators__.getitem_loss: 0.0636 - val_tf.__operators__.getitem_1_loss: 0.0139 - val_tf.__operators__.getitem_2_loss: 0.0693 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.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653] [0.74781653]] Reconstructed Values: [[[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]] [[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]] [[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]] ... [[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]] [[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]] [[0.87945034] [0.96653411] [1.02361853] ... [0.9798506 ] [0.923733 ] [0.84530444]]], Forward Prediction: [[0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958] [0.7366958]]