I am not able to load an instance of a custom transformer saved using either sklearn.externals.joblib.dump
or pickle.dump
because the original definiti
sklearn.preprocessing.StandardScaler
works because the class definition is available in the sklearn package installation, which joblib
will look up when you load the pickle.
You'll have to make your CustomTransformer
class available in the new session, either by re-defining or importing it.
It works for me if I pass my transform function in sklearn.preprocessing.FunctionTranformer()
and if I save the model using dill.dump()
and dill.load
a ".pk" file.
Note: I have included the tranform function into a sklearn pipeline with my classifier.