nif.data
- class nif.data.PointWiseData(parameter_data, x_data, u_data, sample_weight=None)
Bases:
object
Represents point-wise data.
- Variables:
data_raw (numpy.ndarray) – Raw data.
data (numpy.ndarray) – Normalized data.
sample_weight (numpy.ndarray) – Sample weights.
n_p (int) – Number of parameter features.
n_x (int) – Number of state features.
n_o (int) – Number of output features.
- property parameter
Returns the parameter data.
- property x
Returns the state data.
- property u
Returns the output data.
- static standard_normalize(raw_data, area_weighted=False)
Performs standard normalization on raw data.
- Parameters:
raw_data (numpy.ndarray) – Raw data.
area_weighted (bool) – Whether to perform area weighting. Defaults to False.
- Returns:
numpy.ndarray – Normalized data. numpy.ndarray: Mean of raw data. numpy.ndarray: Standard deviation of raw data. numpy.ndarray: Normalized sample weights.
- static minmax_normalize(raw_data, n_para, n_x, n_target, area_weighted=False)
Performs min-max normalization on raw data.
- Parameters:
raw_data (numpy.ndarray) – Raw data.
n_para (int) – Number of parameter features.
n_x (int) – Number of state features.
n_target (int) – Number of output features.
area_weighted (bool) – Whether to perform area weighting. Defaults to False.
- Returns:
numpy.ndarray – Normalized data. numpy.ndarray: Mean of raw data. numpy.ndarray: Standard deviation of raw data.
- class nif.data.TFRDataset(n_feature, n_target, area_weight=False)
Bases:
object
A class to handle creating and loading Tensorflow record datasets.
- Parameters:
n_feature (int) – The number of features.
n_target (int) – The number of targets.
area_weight (bool, optional) – Whether or not to use area weights. Defaults to False.
- create_from_npz(num_pts_per_file, npz_path, npz_key, tfr_path, prefix)
Create Tensorflow record files from a numpy file.
- Parameters:
num_pts_per_file (int) – The number of points to put into each Tensorflow record file.
npz_path (str) – The path to the numpy file.
npz_key (str) – The key of the numpy array to use.
tfr_path (str) – The path to the output directory for the Tensorflow record files.
prefix (str) – The prefix to add to each Tensorflow record file name.
- gen_dataset_from_batch_file(batch_file, batch_size)
Generate a TensorFlow Dataset from a batch file.
- Parameters:
batch_file (np.ndarray) – A NumPy array containing the batch data.
batch_size (int) – The batch size.
- Returns:
tf.data.Dataset – A TensorFlow Dataset object.
- get_tfr_meta_dataset(tfr_path, epoch, tfr_shuffle_buffer_size=1)
Get a meta TensorFlow Dataset object from a folder of TFRecord files.
- Parameters:
tfr_path (str) – The path to the folder containing the TFRecord files.
epoch (int) – The number of epochs to iterate through.
tfr_shuffle_buffer_size (int) – The shuffle buffer size.
- Returns:
tf.data.Dataset – A TensorFlow Dataset object.