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:34 - loss: 1.3480 - tf.__operators__.getitem_loss: 1.2053 - tf.__operators__.getitem_1_loss: 1.4350 - tf.__operators__.getitem_2_loss: 1.3165 3/51 [>.............................] - ETA: 1s - loss: 1.1038 - tf.__operators__.getitem_loss: 1.0303 - tf.__operators__.getitem_1_loss: 1.1325 - tf.__operators__.getitem_2_loss: 1.1200 6/51 [==>...........................] - ETA: 1s - loss: 0.8060 - tf.__operators__.getitem_loss: 0.8035 - tf.__operators__.getitem_1_loss: 0.7766 - tf.__operators__.getitem_2_loss: 0.8675 9/51 [====>.........................] - ETA: 1s - loss: 0.5872 - tf.__operators__.getitem_loss: 0.6150 - tf.__operators__.getitem_1_loss: 0.5362 - tf.__operators__.getitem_2_loss: 0.6614 12/51 [======>.......................] - ETA: 0s - loss: 0.4575 - tf.__operators__.getitem_loss: 0.4725 - tf.__operators__.getitem_1_loss: 0.4251 - tf.__operators__.getitem_2_loss: 0.5073 15/51 [=======>......................] - ETA: 0s - loss: 0.3942 - tf.__operators__.getitem_loss: 0.3784 - tf.__operators__.getitem_1_loss: 0.3962 - tf.__operators__.getitem_2_loss: 0.4062 17/51 [=========>....................] - ETA: 0s - loss: 0.3627 - tf.__operators__.getitem_loss: 0.3343 - tf.__operators__.getitem_1_loss: 0.3790 - tf.__operators__.getitem_2_loss: 0.3586 20/51 [==========>...................] - ETA: 0s - loss: 0.3197 - tf.__operators__.getitem_loss: 0.2871 - tf.__operators__.getitem_1_loss: 0.3421 - tf.__operators__.getitem_2_loss: 0.3075 23/51 [============>.................] - ETA: 0s - loss: 0.2842 - tf.__operators__.getitem_loss: 0.2571 - tf.__operators__.getitem_1_loss: 0.3026 - tf.__operators__.getitem_2_loss: 0.2746 26/51 [==============>...............] - ETA: 0s - loss: 0.2573 - tf.__operators__.getitem_loss: 0.2383 - tf.__operators__.getitem_1_loss: 0.2685 - tf.__operators__.getitem_2_loss: 0.2539 29/51 [================>.............] - ETA: 0s - loss: 0.2368 - tf.__operators__.getitem_loss: 0.2255 - tf.__operators__.getitem_1_loss: 0.2411 - tf.__operators__.getitem_2_loss: 0.2397 32/51 [=================>............] - ETA: 0s - loss: 0.2201 - tf.__operators__.getitem_loss: 0.2151 - tf.__operators__.getitem_1_loss: 0.2187 - tf.__operators__.getitem_2_loss: 0.2281 35/51 [===================>..........] - ETA: 0s - loss: 0.2056 - tf.__operators__.getitem_loss: 0.2050 - tf.__operators__.getitem_1_loss: 0.2003 - tf.__operators__.getitem_2_loss: 0.2170 37/51 [====================>.........] - ETA: 0s - loss: 0.1969 - tf.__operators__.getitem_loss: 0.1981 - tf.__operators__.getitem_1_loss: 0.1901 - tf.__operators__.getitem_2_loss: 0.2095 40/51 [======================>.......] - ETA: 0s - loss: 0.1852 - tf.__operators__.getitem_loss: 0.1878 - tf.__operators__.getitem_1_loss: 0.1775 - tf.__operators__.getitem_2_loss: 0.1982 43/51 [========================>.....] - ETA: 0s - loss: 0.1752 - tf.__operators__.getitem_loss: 0.1778 - tf.__operators__.getitem_1_loss: 0.1678 - tf.__operators__.getitem_2_loss: 0.1874 46/51 [==========================>...] - ETA: 0s - loss: 0.1665 - tf.__operators__.getitem_loss: 0.1687 - tf.__operators__.getitem_1_loss: 0.1600 - tf.__operators__.getitem_2_loss: 0.1775 49/51 [===========================>..] - ETA: 0s - loss: 0.1588 - tf.__operators__.getitem_loss: 0.1606 - tf.__operators__.getitem_1_loss: 0.1530 - tf.__operators__.getitem_2_loss: 0.1688 51/51 [==============================] - 7s 45ms/step - loss: 0.1541 - tf.__operators__.getitem_loss: 0.1559 - tf.__operators__.getitem_1_loss: 0.1485 - tf.__operators__.getitem_2_loss: 0.1638 - val_loss: 0.0379 - val_tf.__operators__.getitem_loss: 0.0434 - val_tf.__operators__.getitem_1_loss: 0.0319 - val_tf.__operators__.getitem_2_loss: 0.0443 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.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513] [0.7917513]] Reconstructed Values: [[[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]] [[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]] [[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]] ... [[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]] [[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]] [[0.91271495] [0.99375959] [1.04827404] ... [1.06100426] [1.00457794] [0.91909791]]], Forward Prediction: [[0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408] [0.78943408]]