【问题标题】:Particles in particle swarm optimization algorithm粒子群优化算法中的粒子
【发布时间】:2017-06-11 06:21:24
【问题描述】:

我有一个由矩阵组成的数据集,我想在粒子群优化 (PSO) 算法中使用它们,其中群中的每个粒子都由大小为 MxM 的矩阵表示。

我可以将粒子表示为大小为 MxM 的矩阵,还是必须将它们重塑为大小为 1xM*M 的向量?最好的解决方案应该是矩阵而不是向量。

【问题讨论】:

    标签: algorithm particle-swarm


    【解决方案1】:

    在矩阵的情况下,您的行(样本数)变成粒子,特征(矩阵中的列数)变成维度。一个单独的群包含 1 行和 M 维度。 Swarm 有属性 position (1*M) , Velocity(1*M) 和 Pbest(1*M)

    for i in range(rows):             
                for j in range(dimensions): 
                      # write your code here for swarm                           
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多