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: 1.2201 - tf.__operators__.getitem_loss: 1.2042 - tf.__operators__.getitem_1_loss: 1.2711 - tf.__operators__.getitem_2_loss: 1.1340 4/51 [=>............................] - ETA: 1s - loss: 0.9432 - tf.__operators__.getitem_loss: 1.0009 - tf.__operators__.getitem_1_loss: 0.9296 - tf.__operators__.getitem_2_loss: 0.9127 7/51 [===>..........................] - ETA: 0s - loss: 0.7103 - tf.__operators__.getitem_loss: 0.8195 - tf.__operators__.getitem_1_loss: 0.6554 - tf.__operators__.getitem_2_loss: 0.7108 10/51 [====>.........................] - ETA: 0s - loss: 0.5334 - tf.__operators__.getitem_loss: 0.6592 - tf.__operators__.getitem_1_loss: 0.4679 - tf.__operators__.getitem_2_loss: 0.5386 13/51 [======>.......................] - ETA: 0s - loss: 0.4306 - tf.__operators__.getitem_loss: 0.5286 - tf.__operators__.getitem_1_loss: 0.3888 - tf.__operators__.getitem_2_loss: 0.4164 16/51 [========>.....................] - ETA: 0s - loss: 0.3759 - tf.__operators__.getitem_loss: 0.4358 - tf.__operators__.getitem_1_loss: 0.3646 - tf.__operators__.getitem_2_loss: 0.3385 19/51 [==========>...................] - ETA: 0s - loss: 0.3330 - tf.__operators__.getitem_loss: 0.3737 - tf.__operators__.getitem_1_loss: 0.3365 - tf.__operators__.getitem_2_loss: 0.2853 22/51 [===========>..................] - ETA: 0s - loss: 0.2961 - tf.__operators__.getitem_loss: 0.3334 - tf.__operators__.getitem_1_loss: 0.3007 - tf.__operators__.getitem_2_loss: 0.2495 25/51 [=============>................] - ETA: 0s - loss: 0.2671 - tf.__operators__.getitem_loss: 0.3077 - tf.__operators__.getitem_1_loss: 0.2669 - tf.__operators__.getitem_2_loss: 0.2271 28/51 [===============>..............] - ETA: 0s - loss: 0.2452 - tf.__operators__.getitem_loss: 0.2900 - tf.__operators__.getitem_1_loss: 0.2389 - tf.__operators__.getitem_2_loss: 0.2131 31/51 [=================>............] - ETA: 0s - loss: 0.2277 - tf.__operators__.getitem_loss: 0.2755 - tf.__operators__.getitem_1_loss: 0.2162 - tf.__operators__.getitem_2_loss: 0.2028 34/51 [===================>..........] - ETA: 0s - loss: 0.2126 - tf.__operators__.getitem_loss: 0.2616 - tf.__operators__.getitem_1_loss: 0.1977 - tf.__operators__.getitem_2_loss: 0.1935 37/51 [====================>.........] - ETA: 0s - loss: 0.1993 - tf.__operators__.getitem_loss: 0.2476 - tf.__operators__.getitem_1_loss: 0.1829 - tf.__operators__.getitem_2_loss: 0.1840 40/51 [======================>.......] - ETA: 0s - loss: 0.1879 - tf.__operators__.getitem_loss: 0.2337 - tf.__operators__.getitem_1_loss: 0.1716 - tf.__operators__.getitem_2_loss: 0.1745 43/51 [========================>.....] - ETA: 0s - loss: 0.1780 - tf.__operators__.getitem_loss: 0.2207 - tf.__operators__.getitem_1_loss: 0.1630 - tf.__operators__.getitem_2_loss: 0.1655 46/51 [==========================>...] - ETA: 0s - loss: 0.1695 - tf.__operators__.getitem_loss: 0.2090 - tf.__operators__.getitem_1_loss: 0.1558 - tf.__operators__.getitem_2_loss: 0.1575 49/51 [===========================>..] - ETA: 0s - loss: 0.1619 - tf.__operators__.getitem_loss: 0.1988 - tf.__operators__.getitem_1_loss: 0.1491 - tf.__operators__.getitem_2_loss: 0.1507 51/51 [==============================] - 6s 49ms/step - loss: 0.1572 - tf.__operators__.getitem_loss: 0.1928 - tf.__operators__.getitem_1_loss: 0.1446 - tf.__operators__.getitem_2_loss: 0.1469 - val_loss: 0.0421 - val_tf.__operators__.getitem_loss: 0.0512 - val_tf.__operators__.getitem_1_loss: 0.0295 - val_tf.__operators__.getitem_2_loss: 0.0580 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.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803] [0.77379803]] Reconstructed Values: [[[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]] [[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]] [[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]] ... [[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]] [[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]] [[0.88652211] [0.96732739] [1.02535702] ... [1.01534455] [0.95850643] [0.87714615]]], Forward Prediction: [[0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305] [0.75907305]]