AERΒΆ

path: 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

numpy.ndarray

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

learning_rate

float

float denoting the learning rate of the optimizer. Default is 0.001

batch_size

int

number of samples per gradient update. Default is 64

layers_encoder

list

list containing layers of encoder

layers_generator

list

list containing layers of generator

output

ry_hat

numpy.ndarray

n-dimensional array containing the regression for each input sequence (reverse)

y_hat

numpy.ndarray

n-dimensional array containing the reconstructions for each input sequence

fy_hat

numpy.ndarray

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:23 - loss: 0.7630 - tf.__operators__.getitem_loss: 0.8866 - tf.__operators__.getitem_1_loss: 0.7140 - tf.__operators__.getitem_2_loss: 0.7374
 4/51 [=>............................] - ETA: 1s - loss: 0.5434 - tf.__operators__.getitem_loss: 0.6793 - tf.__operators__.getitem_1_loss: 0.4592 - tf.__operators__.getitem_2_loss: 0.5761  
 7/51 [===>..........................] - ETA: 1s - loss: 0.3834 - tf.__operators__.getitem_loss: 0.5130 - tf.__operators__.getitem_1_loss: 0.2912 - tf.__operators__.getitem_2_loss: 0.4383
10/51 [====>.........................] - ETA: 0s - loss: 0.2869 - tf.__operators__.getitem_loss: 0.3847 - tf.__operators__.getitem_1_loss: 0.2170 - tf.__operators__.getitem_2_loss: 0.3290
13/51 [======>.......................] - ETA: 0s - loss: 0.2448 - tf.__operators__.getitem_loss: 0.2987 - tf.__operators__.getitem_1_loss: 0.2124 - tf.__operators__.getitem_2_loss: 0.2557
16/51 [========>.....................] - ETA: 0s - loss: 0.2168 - tf.__operators__.getitem_loss: 0.2451 - tf.__operators__.getitem_1_loss: 0.2058 - tf.__operators__.getitem_2_loss: 0.2105
18/51 [=========>....................] - ETA: 0s - loss: 0.1995 - tf.__operators__.getitem_loss: 0.2215 - tf.__operators__.getitem_1_loss: 0.1926 - tf.__operators__.getitem_2_loss: 0.1913
21/51 [===========>..................] - ETA: 0s - loss: 0.1781 - tf.__operators__.getitem_loss: 0.1993 - tf.__operators__.getitem_1_loss: 0.1694 - tf.__operators__.getitem_2_loss: 0.1745
24/51 [=============>................] - ETA: 0s - loss: 0.1628 - tf.__operators__.getitem_loss: 0.1868 - tf.__operators__.getitem_1_loss: 0.1491 - tf.__operators__.getitem_2_loss: 0.1663
27/51 [==============>...............] - ETA: 0s - loss: 0.1514 - tf.__operators__.getitem_loss: 0.1785 - tf.__operators__.getitem_1_loss: 0.1329 - tf.__operators__.getitem_2_loss: 0.1615
30/51 [================>.............] - ETA: 0s - loss: 0.1419 - tf.__operators__.getitem_loss: 0.1709 - tf.__operators__.getitem_1_loss: 0.1201 - tf.__operators__.getitem_2_loss: 0.1567
33/51 [==================>...........] - ETA: 0s - loss: 0.1335 - tf.__operators__.getitem_loss: 0.1627 - tf.__operators__.getitem_1_loss: 0.1102 - tf.__operators__.getitem_2_loss: 0.1508
36/51 [====================>.........] - ETA: 0s - loss: 0.1261 - tf.__operators__.getitem_loss: 0.1540 - tf.__operators__.getitem_1_loss: 0.1033 - tf.__operators__.getitem_2_loss: 0.1440
39/51 [=====================>........] - ETA: 0s - loss: 0.1200 - tf.__operators__.getitem_loss: 0.1456 - tf.__operators__.getitem_1_loss: 0.0987 - tf.__operators__.getitem_2_loss: 0.1370
42/51 [=======================>......] - ETA: 0s - loss: 0.1148 - tf.__operators__.getitem_loss: 0.1379 - tf.__operators__.getitem_1_loss: 0.0953 - tf.__operators__.getitem_2_loss: 0.1306
45/51 [=========================>....] - ETA: 0s - loss: 0.1101 - tf.__operators__.getitem_loss: 0.1315 - tf.__operators__.getitem_1_loss: 0.0919 - tf.__operators__.getitem_2_loss: 0.1252
48/51 [===========================>..] - ETA: 0s - loss: 0.1059 - tf.__operators__.getitem_loss: 0.1264 - tf.__operators__.getitem_1_loss: 0.0881 - tf.__operators__.getitem_2_loss: 0.1209
51/51 [==============================] - ETA: 0s - loss: 0.1021 - tf.__operators__.getitem_loss: 0.1224 - tf.__operators__.getitem_1_loss: 0.0842 - tf.__operators__.getitem_2_loss: 0.1177
51/51 [==============================] - 6s 44ms/step - loss: 0.1021 - tf.__operators__.getitem_loss: 0.1224 - tf.__operators__.getitem_1_loss: 0.0842 - tf.__operators__.getitem_2_loss: 0.1177 - val_loss: 0.0419 - val_tf.__operators__.getitem_loss: 0.0627 - val_tf.__operators__.getitem_1_loss: 0.0178 - val_tf.__operators__.getitem_2_loss: 0.0691

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.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]
 [0.74963013]]
Reconstructed Values: [[[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]

 [[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]

 [[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]

 ...

 [[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]

 [[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]

 [[0.85026911]
  [0.92584395]
  [0.98223541]
  ...
  [1.02513585]
  [0.96338957]
  [0.87170058]]], Forward Prediction: [[0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]
 [0.73705127]]