AFAIK没有简单的方法可以做到这一点。 Graphviz只能用于可视化决策树。如果要保存模型,可以使用Pickle保存模型。例如:
import cPickle
# save the classifier
with open('my_dumped_classifier.pkl', 'wb') as fid:
cPickle.dump(gnb, fid)
# load it again
with open('my_dumped_classifier.pkl', 'rb') as fid:
gnb_loaded = cPickle.load(fid)