如何在pyclustering中保存SOM网络模型?

时间:2018-08-16 04:40:12

标签: python machine-learning cluster-computing pickle unsupervised-learning

模型SOM网络无法通过腌制保存,Python会抛出包含指针的ValueValue ctypes对象异常。如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

在pyclustering 0.8.2中已解决问题:

import pickle
from pyclustering.nnet.som import som, type_conn
from pyclustering.utils import read_sample
from pyclustering.samples.definitions import SIMPLE_SAMPLES

sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE1)
network = som(1, 2, type_conn.grid_four)
network.train(sample, 100)

dump_network = pickle.dumps(network)
network = pickle.loads(dump_network)