gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 09:17:21 25 4
gpt4 key购买 nike

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

最佳答案

该问题在 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)

关于python - 如何在pyclustering中保存SOM网络模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51869694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com