In the scikit-learn framework, I believe the fit / transform methods are coded with the following philosophy:
fit changes the state of the "transforming" object but not that of the input
transform doesn't change the state of the "transforming" object but the input
fit_transform changes both the "transforming" object and the input
Or at least this is how I see things.
But objects of the SeparatedBitPlanEncoder class from the lightonml library doesn't behave like this. Instances of this class change their inner state when we call their transform method. I find this misleading because it makes no difference between the transform method and the fit_transform one.
The consequence is that we cannot instanciate one SeparatedBitPlanEncoder and one SeparatedBitPlanDecoder once and for all and then use the same for all the OPU calls ! I can see from here the huge problems such a thing could cause !!!
At the very least, the transform method of SeparatedBitPlanEncoder should be disabled and only fit_transform should remains. This way, it would be clear that we change its state when using it. But an even better improvement would be to have a real fit method that actually fits to its input and then a transform method that would raise an exception if the input values are out of the range of values it is capable to handle.
I really need this feature so I am going to implement it for myself. If you want, I can make a PR when it is done.
Hello,
In the scikit-learn framework, I believe the
fit
/transform
methods are coded with the following philosophy:fit
changes the state of the "transforming" object but not that of the inputtransform
doesn't change the state of the "transforming" object but the inputfit_transform
changes both the "transforming" object and the inputOr at least this is how I see things.
But objects of the
SeparatedBitPlanEncoder
class from thelightonml
library doesn't behave like this. Instances of this class change their inner state when we call theirtransform
method. I find this misleading because it makes no difference between thetransform
method and thefit_transform
one.The consequence is that we cannot instanciate one
SeparatedBitPlanEncoder
and oneSeparatedBitPlanDecoder
once and for all and then use the same for all the OPU calls ! I can see from here the huge problems such a thing could cause !!!At the very least, the
transform
method ofSeparatedBitPlanEncoder
should be disabled and onlyfit_transform
should remains. This way, it would be clear that we change its state when using it. But an even better improvement would be to have a realfit
method that actually fits to its input and then atransform
method that would raise an exception if the input values are out of the range of values it is capable to handle.I really need this feature so I am going to implement it for myself. If you want, I can make a PR when it is done.
Bye