粒子群算法吧 关注:136贴子:900
  • 2回复贴,共1

我写了一个粒子群算法的Python库

只看楼主收藏回复

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


IP属地:北京1楼2019-10-25 23:31回复
    请问如何把sko包里的启发式算法用在sklearn集成算法优化中和tensorflow搭建的nn优化


    6楼2020-02-09 09:37
    回复
      2025-08-03 10:09:27
      广告
      不感兴趣
      开通SVIP免广告
      哥,还在玩不,有个问题想询问一下你,有时间回复一下呗


      IP属地:河南来自Android客户端7楼2023-10-31 20:10
      回复