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)
fit
Fit transformer
fit_transform(y)
fit_transform
Fit and transform data.
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)
transform
Encode iterable with integers.
y (pd.Series) – input data to fit on
self
y (pd.Series) – input data
encoded data
np.ndarray
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
returns encoded data as torch tensor or numpy array depending on input type
Union[torch.Tensor, np.ndarray]