我写了一个粒子群算法的Python库
粒子群算法吧
全部回复
仅看楼主
level 1
github地址:https://github.com/guofei9987/scikit-opt
$pip install scikit-opt
定义目标函数
def demo_func(x):
x1, x2, x3 = x
return x1 ** 2 + (x2 - 0.05) ** 2 + x3 ** 2
优化求解
from sko.PSO import PSO
pso = PSO(func=demo_func, dim=3)
pso.run()
print('best_x is ',pso.gbest_x)
print('best_y is ',pso.gbest_y)
pso.plot_history()
github地址:https://github.com/guofei9987/scikit-opt 欢迎star
另外,这个库总共封装了遗传算法(GA)、粒子群算法(PSO)、蚁群算法(ACA)、模拟退火算法(SA)、免疫优化算法(IA)、人工鱼群算法(AFSA)。
文档在下面,大家探索吧。
中文文档 https://scikit-opt.github.io/scikit-opt/#/docs/zh
documents https://scikit-opt.github.io/scikit-opt/#/docs/en
2019年10月25日 15点10分 1
level 1
请问如何把sko包里的启发式算法用在sklearn集成算法优化中和tensorflow搭建的nn优化
2020年02月09日 01点02分 6
level 1
哥,还在玩不,有个问题想询问一下你,有时间回复一下呗
2023年10月31日 12点10分 7
1