normalizor {LSTMfactors} | R Documentation |
Feature Normalization
Description
This function normalizes a matrix of features using precomputed means and standard deviations.
The function automatically runs load.scaler
to read the standard deviations and means of the features,
which are organized into a list
object named data.scaler.LSTM
.
These means and standard deviations are computed from
the 1,000,000 datasets data.datasets.LSTM
for
training the pre-trained Long Short Term Memory (LSTM) Network.
Usage
normalizor(features)
Arguments
features |
A numeric matrix where each row represents an observation and each column represents a feature. |
Details
The function applies z-score normalization to each element in the features
matrix. It uses
the scaler
object, which is expected to contain precomputed means and standard deviations for each feature.
The normalized value for each element is computed as:
z = \frac{x - \mu}{\sigma}
where x
is the original value, \mu
is the mean, and \sigma
is the standard deviation.
Value
A matrix of the same dimensions as features
, where each feature has been normalized.
See Also
LSTM
, load.scaler
, data.datasets.LSTM
, data.scaler.LSTM
Examples
library(LSTMfactors)
set.seed(123)
##Take the data.DAPCS dataset as an example.
data(data.DAPCS)
response <- as.matrix(data.DAPCS[, 3:22]) ## loading data
## Run extractor.feature function
features <- extractor.feature(response)
features.nor <- normalizor(features)
print(features.nor)