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:08 - loss: 1.1714 - tf.__operators__.getitem_loss: 0.9719 - tf.__operators__.getitem_1_loss: 1.1957 - tf.__operators__.getitem_2_loss: 1.3223 4/51 [=>............................] - ETA: 1s - loss: 0.8341 - tf.__operators__.getitem_loss: 0.7416 - tf.__operators__.getitem_1_loss: 0.7871 - tf.__operators__.getitem_2_loss: 1.0207 7/51 [===>..........................] - ETA: 0s - loss: 0.5849 - tf.__operators__.getitem_loss: 0.5448 - tf.__operators__.getitem_1_loss: 0.5070 - tf.__operators__.getitem_2_loss: 0.7810 10/51 [====>.........................] - ETA: 0s - loss: 0.4333 - tf.__operators__.getitem_loss: 0.3946 - tf.__operators__.getitem_1_loss: 0.3724 - tf.__operators__.getitem_2_loss: 0.5936 13/51 [======>.......................] - ETA: 0s - loss: 0.3666 - tf.__operators__.getitem_loss: 0.3037 - tf.__operators__.getitem_1_loss: 0.3491 - tf.__operators__.getitem_2_loss: 0.4646 16/51 [========>.....................] - ETA: 0s - loss: 0.3201 - tf.__operators__.getitem_loss: 0.2473 - tf.__operators__.getitem_1_loss: 0.3249 - tf.__operators__.getitem_2_loss: 0.3833 19/51 [==========>...................] - ETA: 0s - loss: 0.2798 - tf.__operators__.getitem_loss: 0.2139 - tf.__operators__.getitem_1_loss: 0.2862 - tf.__operators__.getitem_2_loss: 0.3329 22/51 [===========>..................] - ETA: 0s - loss: 0.2494 - tf.__operators__.getitem_loss: 0.1973 - tf.__operators__.getitem_1_loss: 0.2494 - tf.__operators__.getitem_2_loss: 0.3016 25/51 [=============>................] - ETA: 0s - loss: 0.2276 - tf.__operators__.getitem_loss: 0.1897 - tf.__operators__.getitem_1_loss: 0.2200 - tf.__operators__.getitem_2_loss: 0.2806 28/51 [===============>..............] - ETA: 0s - loss: 0.2106 - tf.__operators__.getitem_loss: 0.1848 - tf.__operators__.getitem_1_loss: 0.1968 - tf.__operators__.getitem_2_loss: 0.2640 31/51 [=================>............] - ETA: 0s - loss: 0.1962 - tf.__operators__.getitem_loss: 0.1793 - tf.__operators__.getitem_1_loss: 0.1783 - tf.__operators__.getitem_2_loss: 0.2489 34/51 [===================>..........] - ETA: 0s - loss: 0.1836 - tf.__operators__.getitem_loss: 0.1725 - tf.__operators__.getitem_1_loss: 0.1638 - tf.__operators__.getitem_2_loss: 0.2341 37/51 [====================>.........] - ETA: 0s - loss: 0.1727 - tf.__operators__.getitem_loss: 0.1646 - tf.__operators__.getitem_1_loss: 0.1532 - tf.__operators__.getitem_2_loss: 0.2199 40/51 [======================>.......] - ETA: 0s - loss: 0.1636 - tf.__operators__.getitem_loss: 0.1566 - tf.__operators__.getitem_1_loss: 0.1456 - tf.__operators__.getitem_2_loss: 0.2067 43/51 [========================>.....] - ETA: 0s - loss: 0.1558 - tf.__operators__.getitem_loss: 0.1494 - tf.__operators__.getitem_1_loss: 0.1394 - tf.__operators__.getitem_2_loss: 0.1951 46/51 [==========================>...] - ETA: 0s - loss: 0.1489 - tf.__operators__.getitem_loss: 0.1433 - tf.__operators__.getitem_1_loss: 0.1335 - tf.__operators__.getitem_2_loss: 0.1853 49/51 [===========================>..] - ETA: 0s - loss: 0.1427 - tf.__operators__.getitem_loss: 0.1385 - tf.__operators__.getitem_1_loss: 0.1275 - tf.__operators__.getitem_2_loss: 0.1772 51/51 [==============================] - 6s 49ms/step - loss: 0.1389 - tf.__operators__.getitem_loss: 0.1359 - tf.__operators__.getitem_1_loss: 0.1234 - tf.__operators__.getitem_2_loss: 0.1727 - val_loss: 0.0461 - val_tf.__operators__.getitem_loss: 0.0756 - val_tf.__operators__.getitem_1_loss: 0.0211 - val_tf.__operators__.getitem_2_loss: 0.0665 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.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681] [0.72499681]] Reconstructed Values: [[[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]] [[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]] [[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]] ... [[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]] [[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]] [[0.83495353] [0.91743553] [0.97877403] ... [1.00492918] [0.94143304] [0.8560517 ]]], Forward Prediction: [[0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537] [0.74208537]]