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:08 - loss: 0.9175 - tf.__operators__.getitem_loss: 1.0453 - tf.__operators__.getitem_1_loss: 0.9086 - tf.__operators__.getitem_2_loss: 0.8074
 4/51 [=>............................] - ETA: 1s - loss: 0.6055 - tf.__operators__.getitem_loss: 0.7853 - tf.__operators__.getitem_1_loss: 0.5376 - tf.__operators__.getitem_2_loss: 0.5615  
 7/51 [===>..........................] - ETA: 1s - loss: 0.4014 - tf.__operators__.getitem_loss: 0.5800 - tf.__operators__.getitem_1_loss: 0.3243 - tf.__operators__.getitem_2_loss: 0.3771
10/51 [====>.........................] - ETA: 0s - loss: 0.3085 - tf.__operators__.getitem_loss: 0.4307 - tf.__operators__.getitem_1_loss: 0.2689 - tf.__operators__.getitem_2_loss: 0.2655
13/51 [======>.......................] - ETA: 0s - loss: 0.2683 - tf.__operators__.getitem_loss: 0.3377 - tf.__operators__.getitem_1_loss: 0.2653 - tf.__operators__.getitem_2_loss: 0.2047
16/51 [========>.....................] - ETA: 0s - loss: 0.2334 - tf.__operators__.getitem_loss: 0.2829 - tf.__operators__.getitem_1_loss: 0.2417 - tf.__operators__.getitem_2_loss: 0.1674
19/51 [==========>...................] - ETA: 0s - loss: 0.2047 - tf.__operators__.getitem_loss: 0.2518 - tf.__operators__.getitem_1_loss: 0.2098 - tf.__operators__.getitem_2_loss: 0.1475
22/51 [===========>..................] - ETA: 0s - loss: 0.1844 - tf.__operators__.getitem_loss: 0.2339 - tf.__operators__.getitem_1_loss: 0.1822 - tf.__operators__.getitem_2_loss: 0.1390
25/51 [=============>................] - ETA: 0s - loss: 0.1697 - tf.__operators__.getitem_loss: 0.2218 - tf.__operators__.getitem_1_loss: 0.1608 - tf.__operators__.getitem_2_loss: 0.1357
28/51 [===============>..............] - ETA: 0s - loss: 0.1580 - tf.__operators__.getitem_loss: 0.2110 - tf.__operators__.getitem_1_loss: 0.1439 - tf.__operators__.getitem_2_loss: 0.1330
31/51 [=================>............] - ETA: 0s - loss: 0.1476 - tf.__operators__.getitem_loss: 0.1998 - tf.__operators__.getitem_1_loss: 0.1308 - tf.__operators__.getitem_2_loss: 0.1292
34/51 [===================>..........] - ETA: 0s - loss: 0.1386 - tf.__operators__.getitem_loss: 0.1881 - tf.__operators__.getitem_1_loss: 0.1212 - tf.__operators__.getitem_2_loss: 0.1241
37/51 [====================>.........] - ETA: 0s - loss: 0.1311 - tf.__operators__.getitem_loss: 0.1767 - tf.__operators__.getitem_1_loss: 0.1146 - tf.__operators__.getitem_2_loss: 0.1184
40/51 [======================>.......] - ETA: 0s - loss: 0.1248 - tf.__operators__.getitem_loss: 0.1664 - tf.__operators__.getitem_1_loss: 0.1100 - tf.__operators__.getitem_2_loss: 0.1129
43/51 [========================>.....] - ETA: 0s - loss: 0.1193 - tf.__operators__.getitem_loss: 0.1575 - tf.__operators__.getitem_1_loss: 0.1057 - tf.__operators__.getitem_2_loss: 0.1082
46/51 [==========================>...] - ETA: 0s - loss: 0.1144 - tf.__operators__.getitem_loss: 0.1504 - tf.__operators__.getitem_1_loss: 0.1013 - tf.__operators__.getitem_2_loss: 0.1045
49/51 [===========================>..] - ETA: 0s - loss: 0.1099 - tf.__operators__.getitem_loss: 0.1447 - tf.__operators__.getitem_1_loss: 0.0966 - tf.__operators__.getitem_2_loss: 0.1017
51/51 [==============================] - 6s 52ms/step - loss: 0.1073 - tf.__operators__.getitem_loss: 0.1416 - tf.__operators__.getitem_1_loss: 0.0936 - tf.__operators__.getitem_2_loss: 0.1003 - val_loss: 0.0418 - val_tf.__operators__.getitem_loss: 0.0678 - val_tf.__operators__.getitem_1_loss: 0.0169 - val_tf.__operators__.getitem_2_loss: 0.0658

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.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]
 [0.73955936]]
Reconstructed Values: [[[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]

 [[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]

 [[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]

 ...

 [[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]

 [[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]

 [[0.86043838]
  [0.94514086]
  [1.00418548]
  ...
  [0.98961667]
  [0.93373583]
  [0.85496693]]], Forward Prediction: [[0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]
 [0.74350699]]