Utils
- utils.check_is_fitted(obj, variable='delta')[source]
Check if for the current layer is available the backward function.
- Parameters
obj (layer type) – The object used as self
variable (str) – The variable name which allows the backward status if it is not None
Notes
Note
The backward function can be used ONLY after the forward procedure. This function allows to check if the forward function has been already applied.
- class utils.cost_type(value)[source]
Bases:
int
,enum.Enum
An enumeration.
- hellinger = 6
- hinge = 7
- logcosh = 8
- mae = 2
- masked = 1
- mse = 0
- seg = 3
- smooth = 4
- wgan = 5
- utils.data_to_timesteps(data, steps, shift=1)[source]
- Prepare data for a Recurrent model, dividing a series of data with shape (Ndata, features)
into timesteps, with shapes (Ndata - steps + 1, steps, features) If ‘data’ has more than two dimension, it’ll be reshaped. Pay attention to the final number of ‘batch’
- Parameters
data (array-like) – 2 or 4 dimensional numpy array, with shapes (Ndata, features) or (Ndata, w, h, c).
steps (int) – Number of timesteps considered for the Recurrent layer
shift (int (default=1)) – Temporal shift.
- Returns
X (array-like) – A view on the data array of input, for Recurrent layers
y (array-like) – Correspondig labels as time shifted values.
- utils.from_categorical(categoricals)[source]
Convert a one-hot encoding format into a vector of labels
- Parameters
categoricals (array-like 2D) – One-hot encoding format of a label set
- Return type
Corresponding labels in 1D array
- utils.print_statistics(arr)[source]
Compute the common statistics of the input array
- Parameters
arr (array-like) – Input array
- Returns
mse (float) – Mean Squared Error, i.e sqrt(mean(x*x))
mean (float) – Mean of the array
variance (float) – Variance of the array
Notes
Note
The values are printed and returned