# FedPSO Custom strategy

**URL:** <https://discuss.flower.ai/t/fedpso-custom-strategy/328>\
**Category:** Flower Help - Beginners\
**Created:** [September 19, 2024, 11:45am UTC](https://discuss.flower.ai/t/fedpso-custom-strategy/328 "2024-09-19T11:45:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wehtam](https://avatars.discourse-cdn.com/v4/letter/w/41988e/32.png) [@wehtam](https://discuss.flower.ai/u/wehtam)\
**Post date:** [September 19, 2024, 11:45am UTC](https://discuss.flower.ai/t/fedpso-custom-strategy/328/1 "2024-09-19T11:45:29Z")

</div>

So i am trying to implement the strategy mentioned in this paper

> **[FedPSO: Federated Learning Using Particle Swarm Optimization to Reduce...](https://www.mdpi.com/1424-8220/21/2/600)**
>
> Federated learning is a learning method that collects only learned models on a server to ensure data privacy. This method does not collect data on the server but instead proceeds with data directly from distributed clients. Because federated learning...

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/flower/original/1X/ecd67c5d5dae06ca28ad5619ece50a75c44d35a5.png)  
The issue im facing right now is the getbestmodel method  
Im not able to figure out how to do that second call to get the weights from client since aggreggate\_fir gets called only once per global epoch  
Any help is appreciated 😄

---

<div class="post-metadata">

**Author:** ![mohammad](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/mohammad/32/35_2.png) [@mohammad](https://discuss.flower.ai/u/mohammad)\
**Post date:** [September 24, 2024, 9:45pm UTC](https://discuss.flower.ai/t/fedpso-custom-strategy/328/2 "2024-09-24T21:45:11Z")

</div>

Hi @wehtam , thanks for your question.  
I think you actually don’t need to have the `GETBESTMODEL` call to receive the model params from the specific client.  
As you already have the `gid` which is essentially the `client_id`, and you can get the model for that client by its `id` at the server side. Does it make sense?

---

<div class="post-metadata">

**Author:** ![wehtam](https://avatars.discourse-cdn.com/v4/letter/w/41988e/32.png) [@wehtam](https://discuss.flower.ai/u/wehtam)\
**Post date:** [September 25, 2024, 2:52am UTC](https://discuss.flower.ai/t/fedpso-custom-strategy/328/3 "2024-09-25T02:52:36Z")

</div>

oh okay I am new to flower so where can i read about how that works or any similar code examples?

---

<div class="post-metadata">

**Author:** ![mohammad](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/mohammad/32/35_2.png) [@mohammad](https://discuss.flower.ai/u/mohammad)\
**Post date:** [September 30, 2024, 1:41pm UTC](https://discuss.flower.ai/t/fedpso-custom-strategy/328/4 "2024-09-30T13:41:01Z")

</div>

Here is a link that helps with the custom strategy: [Use strategies - Flower Framework](https://flower.ai/docs/framework/how-to-use-strategies.html)

Once you have a custom strategy, then you can access the model of each clients at the server side.
