Slackbot
03/22/2023, 12:17 PMBenjamin Tan
03/22/2023, 1:20 PMShane Nolan
03/22/2023, 1:22 PMfrom sklearn.preprocessing import OrdinalEncoder
enc = OrdinalEncoder()
enc.fit()
enc.transform()
I can pickle.dump this object but I was wondering what would be the best approach to load it in a bentoml service such as a runner etcBenjamin Tan
03/22/2023, 1:23 PMBenjamin Tan
03/22/2023, 1:24 PMShane Nolan
03/22/2023, 1:24 PMBenjamin Tan
03/22/2023, 1:26 PMdef __init__(self):
self.enc = OrdinalEncoder()
Shane Nolan
03/22/2023, 1:31 PMBenjamin Tan
03/22/2023, 1:31 PMBenjamin Tan
03/22/2023, 1:31 PMBenjamin Tan
03/22/2023, 1:32 PMShane Nolan
03/22/2023, 1:33 PMShane Nolan
03/22/2023, 1:33 PMYilun Zhang
03/22/2023, 3:40 PMOrdinalEncoder
object each time and fit + transform, but rather use the one you created during training so that you don’t run into new values. So it might be suitable to use custom_objects
when you are saving the model to save the encoder at training time, then load it when you are creating BentoML services.