訓練された分類器をどのように保存するかについて、少し混乱しています。のように、使用するたびに分類器を再トレーニングすることは明らかに非常に悪くて遅いですが、どうすればそれを保存し、必要なときに再度ロードすることができますか?コードは以下のとおりです。よろしくお願いします。NLTKナイーブベイズ分類器でPythonを使用しています。
classifier = nltk.NaiveBayesClassifier.train(training_set)
# look inside the classifier train method in the source code of the NLTK library
def train(labeled_featuresets, estimator=nltk.probability.ELEProbDist):
# Create the P(label) distribution
label_probdist = estimator(label_freqdist)
# Create the P(fval|label, fname) distribution
feature_probdist = {}
return NaiveBayesClassifier(label_probdist, feature_probdist)