transforms#

Classes

AsSet()

The .as_set(["x", "y"]) transform indicates that both x and y are treated as sets.

AsTimeSeries()

The .as_time_series transform can be used to indicate that variables shall be treated as time series.

Broadcast(keys, *, to[, expand, exclude, ...])

Broadcasts arrays or scalars to the shape of a given other array.

Concatenate(keys, *, into[, axis, indices])

Concatenate multiple arrays into a new key.

Constrain(*[, lower, upper, method, ...])

Constrains neural network predictions of a data variable to specified bounds.

ConvertDType(from_dtype, to_dtype)

Default transform used to convert all floats from float64 to float32 to be in line with keras framework.

Drop(keys)

Transform to drop variables from further calculation.

ElementwiseTransform()

Base class on which other transforms are based

ExpandDims(*, axis)

Expand the shape of an array.

FilterTransform([include, predicate, ...])

Implements a transform that applies a different transform on a subset of the data.

Group(keys, into[, prefix])

Groups the given variables as a dictionary in the key into.

Keep(keys)

Name the data parameters that should be kept for futher calculation.

Log(*[, p1])

Log transforms a variable.

MapTransform(transform_map)

Implements a transform that applies a set of elementwise transforms to a subset of the data as given by a mapping.

NNPE(*[, spike_scale, slab_scale, ...])

Implements noisy neural posterior estimation (NNPE) as described in [1], which adds noise following a spike-and-slab distribution to the training data as a mild form of data augmentation to robustify against noisy real-world data (see [1, 2] for benchmarks).

NanToNum(key[, default_value, return_mask, ...])

Replace NaNs with a default value, and optionally encode a missing-data mask as a separate output key.

NumpyTransform(forward[, inverse])

A class to apply element-wise transformations using plain NumPy functions.

OneHot(num_classes)

Changes data to be one-hot encoded.

RandomSubsample(sample_size[, axis])

A transform that takes a random subsample of the data within an axis.

Rename(from_key, to_key)

Transform to rename keys in data dictionary.

Scale(scale)

SerializableCustomTransform(*, forward, inverse)

Transforms a parameter using a pair of registered serializable forward and inverse functions.

Shift(shift)

Split(key, into[, indices_or_sections, axis])

This is the effective inverse of the Concatenate Transform.

Sqrt()

Square-root transform a variable.

Squeeze(*, axis)

Squeeze dimensions of an array.

Standardize([mean, std, axis, momentum])

Transform that when applied standardizes data using typical z-score standardization i.e. for some unstandardized data x the standardized version z would be.

Take(indices[, axis])

A transform to reduce the dimensionality of arrays output by the summary network Example: adapter.take("x", np.arange(0,3), axis=-1)

ToArray([original_type])

Checks provided data for any non-arrays and converts them to numpy arrays.

ToDict()

Convert non-dict batches (e.g., pandas.DataFrame) to dict batches

Transform()

Base class on which other transforms are based

Ungroup(key[, prefix])

Ungroups the the variables in key from a dictionary into individual entries.