utils package¶
Submodules¶
utils.ModelScaler module¶
-
class
utils.ModelScaler.ModelScaler(xdim=None)¶ Bases:
objectNormalise the inputs and outputs to the NN model.
-
fit(inputs, targets)¶ Fits the scaler to the model inputs and targets.
Parameters: - inputs (np.array or tf.Tensor) – shape N x 16 + 2
- targets (np.array or tf.Tensor) – shape N x 16
-
get_vars()¶ Returns the tf.variables of the scaler objects used
-
inverse_transformInput(input)¶ Returns the inverse transform of the inputs
Parameters: input (np.array or tf.Tensor) – shape N x nS + nU or M x N x nS + nU Returns: shape N x nS + nU or M x N x nS + nU Return type: np.array or tf.Tensor
-
inverse_transformOutput(mean, variance)¶ Normalises the inverse transform of the targets to the NN model.
Parameters: - mean (np.array or tf.Tensor) – shape N x nS
- variance (np.array or tf.Tensor) – shape N x nS
Returns: shape N x nS
Return type: np.array or tf.Tensor
-
transformInput(input)¶ Normalises the inputs to the NN model.
Parameters: input (np.array or tf.Tensor) – shape N x nS + nU or M x N x nS + nU Returns: shape N x nS + nU or M x N x nS + nU Return type: np.array or tf.Tensor
-
transformTarget(targets)¶ Normalises the targets to the NN model.
Parameters: targets (np.array or tf.Tensor) – shape N x nS Returns: shape N x nS Return type: np.array or tf.Tensor
-
utils.TensorStandardScaler module¶
-
class
utils.TensorStandardScaler.TensorStandardScaler(x_dim, name=0)¶ Bases:
objectHelper class for automatically normalizing inputs into the network.
-
cache()¶ Caches current values of this scaler.
Returns: None.
-
fit(data)¶ Runs two ops, one for assigning the mean of the data to the internal mean, and another for assigning the standard deviation of the data to the internal standard deviation. This function must be called within a ‘with <session>.as_default()’ block.
Arguments: data (np.ndarray): A numpy array containing the input
Returns: None.
-
get_vars()¶ Returns a list of variables managed by this object.
Returns: (list<tf.Variable>) The list of variables.
-
inverse_transform(data)¶ Undoes the transformation performed by this scaler.
Arguments: data (np.array): A numpy array containing the points to be transformed.
Returns: (np.array) The transformed dataset.
-
load_cache()¶ Loads values from the cache
Returns: None.
-
transform(data)¶ Transforms the input matrix data using the parameters of this scaler.
Arguments: data (np.array): A numpy array containing the points to be transformed.
Returns: (np.array) The transformed dataset.
-
-
class
utils.TensorStandardScaler.TensorStandardScaler1D(name=0)¶ Bases:
utils.TensorStandardScaler.TensorStandardScalerHelper class for automatically normalizing inputs into the network.
-
fit(data)¶ Runs two ops, one for assigning the mean of the data to the internal mean, and another for assigning the standard deviation of the data to the internal standard deviation. This function must be called within a ‘with <session>.as_default()’ block.
Arguments: data (np.ndarray): A numpy array containing the input
Returns: None.
-