We'd like to be able to get a transformer into a fitted state using known parameters instead of existing data. This would allow us to set up a transformer to be able to reverse transform without first having to fit it on real data.
Expected behavior
Add the method _set_fitted_parameters to the FloatFormatter. When called, the provided arguments should be set on the transformer to get it into a 'fitted' state so that it can be used to reverse transform. After being called, a user should be able to call reverse_transform and have it work as expected.
column_names [str]: The name of the column to use for the transformer. Used to set self.columns and self.output_columns.
min_max_values [tuple or None]: None or a tuple containing the (min, max) values for the transformer. Should be used to set self._min_value and self._max_value. If self.enfore_min_max_values is True, it cannot be None.
null_transformer [a NullTransformer instance]: A fitted null transformer instance that can be used to generate null values for the column.
rounding_digits [None or int]: The number of digits to round to. Should be used to set self._rounding_digits. If None then self.learn_rounding_scheme must be False.
dtype [str]: The pandas dtype the reversed data should be converted to. Should be used to set self._dtype.
This method should not return anything. It should validate the parameters that are passed in, especially that the null transformer is compatible.
Problem Description
We'd like to be able to get a transformer into a fitted state using known parameters instead of existing data. This would allow us to set up a transformer to be able to reverse transform without first having to fit it on real data.
Expected behavior
Add the method
_set_fitted_parameters
to theFloatFormatter
. When called, the provided arguments should be set on the transformer to get it into a 'fitted' state so that it can be used to reverse transform. After being called, a user should be able to callreverse_transform
and have it work as expected.def _set_fitted_parameters(self, output_columns, min_max_values, null_transformer, rounding_digits, dtype='float64')
self.columns
andself.output_columns
.None
or a tuple containing the (min, max) values for the transformer. Should be used to setself._min_value
andself._max_value
. Ifself.enfore_min_max_values
isTrue
, it cannot beNone
.NullTransformer
instance]: A fitted null transformer instance that can be used to generate null values for the column.None
or int]: The number of digits to round to. Should be used to setself._rounding_digits
. IfNone
thenself.learn_rounding_scheme
must beFalse
.self._dtype
.This method should not return anything. It should validate the parameters that are passed in, especially that the null transformer is compatible.