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: 0.8386 - tf.__operators__.getitem_loss: 0.8883 - tf.__operators__.getitem_1_loss: 0.7989 - tf.__operators__.getitem_2_loss: 0.8685 4/51 [=>............................] - ETA: 1s - loss: 0.5751 - tf.__operators__.getitem_loss: 0.6619 - tf.__operators__.getitem_1_loss: 0.4914 - tf.__operators__.getitem_2_loss: 0.6555 7/51 [===>..........................] - ETA: 0s - loss: 0.3906 - tf.__operators__.getitem_loss: 0.4757 - tf.__operators__.getitem_1_loss: 0.3013 - tf.__operators__.getitem_2_loss: 0.4843 10/51 [====>.........................] - ETA: 0s - loss: 0.2958 - tf.__operators__.getitem_loss: 0.3433 - tf.__operators__.getitem_1_loss: 0.2411 - tf.__operators__.getitem_2_loss: 0.3578 13/51 [======>.......................] - ETA: 0s - loss: 0.2577 - tf.__operators__.getitem_loss: 0.2644 - tf.__operators__.getitem_1_loss: 0.2442 - tf.__operators__.getitem_2_loss: 0.2779 16/51 [========>.....................] - ETA: 0s - loss: 0.2274 - tf.__operators__.getitem_loss: 0.2168 - tf.__operators__.getitem_1_loss: 0.2314 - tf.__operators__.getitem_2_loss: 0.2299 19/51 [==========>...................] - ETA: 0s - loss: 0.2005 - tf.__operators__.getitem_loss: 0.1897 - tf.__operators__.getitem_1_loss: 0.2047 - tf.__operators__.getitem_2_loss: 0.2028 22/51 [===========>..................] - ETA: 0s - loss: 0.1806 - tf.__operators__.getitem_loss: 0.1763 - tf.__operators__.getitem_1_loss: 0.1786 - tf.__operators__.getitem_2_loss: 0.1889 25/51 [=============>................] - ETA: 0s - loss: 0.1666 - tf.__operators__.getitem_loss: 0.1696 - tf.__operators__.getitem_1_loss: 0.1577 - tf.__operators__.getitem_2_loss: 0.1812 28/51 [===============>..............] - ETA: 0s - loss: 0.1555 - tf.__operators__.getitem_loss: 0.1645 - tf.__operators__.getitem_1_loss: 0.1412 - tf.__operators__.getitem_2_loss: 0.1750 31/51 [=================>............] - ETA: 0s - loss: 0.1458 - tf.__operators__.getitem_loss: 0.1586 - tf.__operators__.getitem_1_loss: 0.1283 - tf.__operators__.getitem_2_loss: 0.1679 34/51 [===================>..........] - ETA: 0s - loss: 0.1371 - tf.__operators__.getitem_loss: 0.1513 - tf.__operators__.getitem_1_loss: 0.1186 - tf.__operators__.getitem_2_loss: 0.1598 37/51 [====================>.........] - ETA: 0s - loss: 0.1298 - tf.__operators__.getitem_loss: 0.1435 - tf.__operators__.getitem_1_loss: 0.1121 - tf.__operators__.getitem_2_loss: 0.1512 40/51 [======================>.......] - ETA: 0s - loss: 0.1236 - tf.__operators__.getitem_loss: 0.1361 - tf.__operators__.getitem_1_loss: 0.1077 - tf.__operators__.getitem_2_loss: 0.1429 43/51 [========================>.....] - ETA: 0s - loss: 0.1183 - tf.__operators__.getitem_loss: 0.1296 - tf.__operators__.getitem_1_loss: 0.1038 - tf.__operators__.getitem_2_loss: 0.1358 46/51 [==========================>...] - ETA: 0s - loss: 0.1134 - tf.__operators__.getitem_loss: 0.1243 - tf.__operators__.getitem_1_loss: 0.0997 - tf.__operators__.getitem_2_loss: 0.1300 49/51 [===========================>..] - ETA: 0s - loss: 0.1090 - tf.__operators__.getitem_loss: 0.1203 - tf.__operators__.getitem_1_loss: 0.0952 - tf.__operators__.getitem_2_loss: 0.1255 51/51 [==============================] - 6s 42ms/step - loss: 0.1064 - tf.__operators__.getitem_loss: 0.1181 - tf.__operators__.getitem_1_loss: 0.0922 - tf.__operators__.getitem_2_loss: 0.1230 - val_loss: 0.0413 - val_tf.__operators__.getitem_loss: 0.0664 - val_tf.__operators__.getitem_1_loss: 0.0169 - val_tf.__operators__.getitem_2_loss: 0.0648 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.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502] [0.7422502]] Reconstructed Values: [[[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]] [[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]] [[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]] ... [[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]] [[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]] [[0.87212301] [0.95774868] [1.01512889] ... [0.96911701] [0.91604334] [0.84378111]]], Forward Prediction: [[0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028] [0.74543028]]