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:20 - loss: 0.7771 - tf.__operators__.getitem_loss: 0.8326 - tf.__operators__.getitem_1_loss: 0.7290 - tf.__operators__.getitem_2_loss: 0.8178 4/51 [=>............................] - ETA: 1s - loss: 0.5265 - tf.__operators__.getitem_loss: 0.6545 - tf.__operators__.getitem_1_loss: 0.4375 - tf.__operators__.getitem_2_loss: 0.5765 7/51 [===>..........................] - ETA: 0s - loss: 0.3532 - tf.__operators__.getitem_loss: 0.4960 - tf.__operators__.getitem_1_loss: 0.2644 - tf.__operators__.getitem_2_loss: 0.3881 10/51 [====>.........................] - ETA: 0s - loss: 0.2780 - tf.__operators__.getitem_loss: 0.3720 - tf.__operators__.getitem_1_loss: 0.2334 - tf.__operators__.getitem_2_loss: 0.2731 13/51 [======>.......................] - ETA: 0s - loss: 0.2451 - tf.__operators__.getitem_loss: 0.2949 - tf.__operators__.getitem_1_loss: 0.2376 - tf.__operators__.getitem_2_loss: 0.2104 16/51 [========>.....................] - ETA: 0s - loss: 0.2138 - tf.__operators__.getitem_loss: 0.2521 - tf.__operators__.getitem_1_loss: 0.2151 - tf.__operators__.getitem_2_loss: 0.1730 19/51 [==========>...................] - ETA: 0s - loss: 0.1889 - tf.__operators__.getitem_loss: 0.2303 - tf.__operators__.getitem_1_loss: 0.1853 - tf.__operators__.getitem_2_loss: 0.1545 22/51 [===========>..................] - ETA: 0s - loss: 0.1720 - tf.__operators__.getitem_loss: 0.2188 - tf.__operators__.getitem_1_loss: 0.1607 - tf.__operators__.getitem_2_loss: 0.1476 25/51 [=============>................] - ETA: 0s - loss: 0.1596 - tf.__operators__.getitem_loss: 0.2102 - tf.__operators__.getitem_1_loss: 0.1419 - tf.__operators__.getitem_2_loss: 0.1443 28/51 [===============>..............] - ETA: 0s - loss: 0.1489 - tf.__operators__.getitem_loss: 0.2007 - tf.__operators__.getitem_1_loss: 0.1272 - tf.__operators__.getitem_2_loss: 0.1406 31/51 [=================>............] - ETA: 0s - loss: 0.1395 - tf.__operators__.getitem_loss: 0.1898 - tf.__operators__.getitem_1_loss: 0.1165 - tf.__operators__.getitem_2_loss: 0.1350 34/51 [===================>..........] - ETA: 0s - loss: 0.1315 - tf.__operators__.getitem_loss: 0.1782 - tf.__operators__.getitem_1_loss: 0.1096 - tf.__operators__.getitem_2_loss: 0.1284 37/51 [====================>.........] - ETA: 0s - loss: 0.1249 - tf.__operators__.getitem_loss: 0.1673 - tf.__operators__.getitem_1_loss: 0.1053 - tf.__operators__.getitem_2_loss: 0.1218 40/51 [======================>.......] - ETA: 0s - loss: 0.1194 - tf.__operators__.getitem_loss: 0.1579 - tf.__operators__.getitem_1_loss: 0.1017 - tf.__operators__.getitem_2_loss: 0.1162 43/51 [========================>.....] - ETA: 0s - loss: 0.1143 - tf.__operators__.getitem_loss: 0.1503 - tf.__operators__.getitem_1_loss: 0.0976 - tf.__operators__.getitem_2_loss: 0.1119 46/51 [==========================>...] - ETA: 0s - loss: 0.1098 - tf.__operators__.getitem_loss: 0.1445 - tf.__operators__.getitem_1_loss: 0.0930 - tf.__operators__.getitem_2_loss: 0.1089 49/51 [===========================>..] - ETA: 0s - loss: 0.1059 - tf.__operators__.getitem_loss: 0.1399 - tf.__operators__.getitem_1_loss: 0.0884 - tf.__operators__.getitem_2_loss: 0.1067 51/51 [==============================] - 6s 43ms/step - loss: 0.1035 - tf.__operators__.getitem_loss: 0.1372 - tf.__operators__.getitem_1_loss: 0.0856 - tf.__operators__.getitem_2_loss: 0.1055 - val_loss: 0.0445 - val_tf.__operators__.getitem_loss: 0.0713 - val_tf.__operators__.getitem_1_loss: 0.0163 - val_tf.__operators__.getitem_2_loss: 0.0741 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.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312] [0.73301312]] Reconstructed Values: [[[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]] [[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]] [[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]] ... [[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]] [[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]] [[0.85093788] [0.93476129] [0.99410671] ... [0.9771176 ] [0.91771306] [0.83665791]]], Forward Prediction: [[0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667] [0.72778667]]