cran2367 / sgt

Sequence Graph Transform
104 stars 21 forks source link

Save Fitted Embedding Model #9

Closed daehwanahn closed 3 years ago

daehwanahn commented 3 years ago

Hi,

I understand that 'sgt.transform' function can be used to infer new data's embedding information by using fitted embedding information with training dataset.

sgt = SGT(...) training_embedding = sgt.fit_transform(corpus=train_sequences) testing_embedding = sgt.transform(corpus=test_sequences) # Here the fitted sgt on training will be used on the test data.

But, how can I save the fitted embedding information for future inference or deployment? I already saw your spark and pickle example, but not for the normal setting. Since training_embedding is DataFrame format in the normal setting, I think there is another way to save the embedded model.

Thank you

cran2367 commented 3 years ago

The pickle works in any setting. You can use it to save the model (the sgt object).

If you are interested in only saving the embedding, you can save it in any text format as well because it is a dataframe.