How to implement Crow Search Algorithm and kmeans

I’ve been trying to implement my base paper which is about community detection using deep learning for more than a year. In this paper Crow Search Algorithm and kmeans have been used but I can’t figure out how to implement it correctly.

Link to download the paper

As I understand the paper follows these steps to implement Crow Search:

  1. creating an initial population
  2. pass positions to fitness function
  3. calculate nmi for positions (with ground truth labels, I have ground truths for datasets in the paper)
  4. return positions with best nmi scores
  5. find best positions
  6. pass best positions to kmeans to use as centroids
  7. kmeans finds final result (which are communities)

When I tried to implement this part, after position passed to fitness function (step 2), nmi can’t be calculated (step 3), because created initial population are not discrete numbers but ground truths are discrete. I don’t know how to fix it.

Chat GPT suggests to use kmeans here in fitness function, then calculate nmi using kmeans resualts.
This way I have to use kmeans in two different places, one in fitness function and two at the very end of the code to find final communities.

I tried this solution but at the end I don’t get correct answers. Four metrics must be calculated after final communities are found: NMI, Precision, Recall and Modularity matrix, but I could not get the right answer same as tables in the paper.

What is the correct solution? If you understand the paper please explain it to me.
If anyone could help me with this I’d appreciate it. I’m short in time and have no clue at all.

I tried every way I could think of and used GPT for help but didn’t work.
I even paid money to someone to implement this code for me but they just gave me some completely incorrect implementations and wasted my time and never returned my money.

So if anyone here could help me with this I’d don’t know how to thank them.

(Edit. Here is the algorithm according to page 9.)

Input: S : Flock Size,
    d : number of dimensions,
    F : Set of all possible solutions and values,
    itermax : Max number of iterations,
    fl : flight length,
    AP : Awareness probability
Output: Optimal positions
1: crowPositions ← InitializeRandomPosition(d, F, S)
2: Memory ← InitializeMemory(d, F, S)
3: Fitness ← CalculateFitness(CrowPositions)
4: score ← NMIscore(ActualLabels, PredictedClusterLabels)
5: while k < itermax
6:     for i ← 1 to S
7:         ri ← GenerateRandom()
8:         RandomCrow ← ChooseRandomCrow(S)
9:         NewPosn ← UpdatePosn(CrowPositions, i, Memory, RandomCrow, AP, ri)
10:    endfor
11:    if NewPosn ∈ F
12:        CrowPostions ← NewPosn
13:    endif
14:    NewFitness ← CalculateFitness(CrowPostions)
15:    if NewFitness > Fitness
16:        Memory ← CrowPostions
17:    endif
18:    k ← k + 1
19: endwhile
20: return crow position with best fitness out of all CrowPostions

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật