pytorch_forecasting.data.encoders.
NaNLabelEncoder
Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin
sklearn.base.BaseEstimator
sklearn.base.TransformerMixin
Labelencoder that can optionally always encode nan and unknown classes (in transform) as class 0
0
init NaNLabelEncoder
add_nan – if to force encoding of nan at 0
warn – if to warn if additional nans are added because items are unknown
Methods
fit(y[, overwrite])
fit
Fit transformer
fit_transform(y[, overwrite])
fit_transform
Fit and transform data.
get_parameters([groups, group_names])
get_parameters
Get fitted scaling parameters for a given group.
get_params([deep])
get_params
Get parameters for this estimator.
inverse_transform(y)
inverse_transform
Decode data, i.e. transform from integers to labels.
is_numeric(y)
is_numeric
Determine if series is numeric or not.
set_params(**params)
set_params
Set the parameters of this estimator.
transform(y[, return_norm, target_scale, …])
transform
Encode iterable with integers.
y (pd.Series) – input data to fit on
overwrite (bool) – if to overwrite current mappings or if to add to it.
self
y (pd.Series) – input data
encoded data
np.ndarray
All parameters are unused - exists for compatability.
zero array.
y (Union[torch.Tensor, np.ndarray]) – encoded data
KeyError – if unknown elements should be decoded
decoded data
Determine if series is numeric or not. Will also return True if series is a categorical type with underlying integers.
y (pd.Series) – series for which to carry out assessment
True if series is numeric
bool
y (Iterable) – iterable to encode
return_norm – only exists for compatability with other encoders - returns a tuple if true.
target_scale – only exists for compatability with other encoders - has no effect.
ignore_na (bool) – if to ignore na values and map them to zeros (this is different to add_nan=True option which maps ONLY NAs to zeros while this options maps the first class and NAs to zeros)
returns encoded data as torch tensor or numpy array depending on input type
Union[torch.Tensor, np.ndarray]