Is it possible to add trained TfIdf vectorizer and trained Logistic regression model into a pipeline to use for new data classification?

Viewed 14

I have trained Logistic regression model for documents classification. I have saved the fit tfidf vectorizer and the model as well. Also, I have created a custom DataCleaner class which inherits BeseEstimator and TransformerMixin. It is basically a custom transformer that allows me to preprocess new data before feeding it in the trained model for classification.

class DataCleaner(BaseEstimator, TransformerMixin):  # takes dataframe 

     def __init__(self, variables):
         self.variables = variables

# more functions here 

TfidfVectorizer(ngram_range=(1, 2))  # new data only .transform
LogisticRegression(C=10.0, class_weight='balanced', max_iter=1000)

Is it possible to create a pipeline that contains these three elements which then will be converted to onnx format?

0 Answers
Related