ljvmiranda921 / comments.ljvmiranda921.github.io

Blog comments for my personal blog: ljvmiranda921.github.io
1 stars 0 forks source link

On building PySwarms #10

Open ljvmiranda921 opened 3 years ago

ljvmiranda921 commented 3 years ago

Written on 08/11/2017 12:51:06

URL: https://ljvmiranda921.github.io/projects/2017/08/11/pyswarms/

ljvmiranda921 commented 3 years ago

Comment written by Vincent Bathory Latte on 09/25/2018 14:44:01

Hi,
I'm trying to replicate this tutorial, but I get this error:

<typeerror: ("'n_particles'="" must="" be="" <type="" 'int'=""> (got 100L that is a <type 'long'="">).", Attribute(name='n_particles', default=Factory(factory=<function n_particles_default="" at="" 0x000000000d4b4908="">, takes_self=True), validator=<instance_of validator="" for="" type="" <type="" 'int'="">>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=<type 'int'="">, converter=None), <type 'int'="">, 100L)>

Can you help me, please?

ljvmiranda921 commented 3 years ago

Comment written by Lj Miranda on 09/27/2018 11:20:23

Hi Vincent,

Thanks for trying-out PySwarms. The API of the library has already changed since this post, so some methods are already deprecated.

I suggest you try out some examples in the official docs (pyswarms.readthedocs.io) or in the github repository :)

Email me if you have more questions and goodluck!

ljvmiranda921 commented 3 years ago

Comment written by StevieLyh on 04/16/2019 10:12:41

Hi,

Can this package solve models with integer variables (not binary)?

ljvmiranda921 commented 3 years ago

Comment written by Lj Miranda on 04/19/2019 05:45:48

Hello, as of now there's no implementation for that. The way to go is extending the pyswarms.discrete module

ljvmiranda921 commented 3 years ago

Comment written by Wayne Filkins on 07/28/2020 14:26:13

I'm trying to use particle swarm optimization with backtrader for optimizing my stock trading strategy. I was using a genetic algorithm but hear this works even better. I'm running it over a couple years of data and it's taking a very long time (several hours) to find the optimized parameters. I'm hoping it won't be as bad if I just use a few months instead, but does anyone have any tricks to speed up the process? I wanted to use GPU but they said that feature doesn't exist yet. I'm using a Ryzen 5 1600 so not the fastest processor but it's highend enough to where even if I get a threadripper or something it might double the speed but it'll still take hours, which is too long considering I want to run it on several hundred stocks every hour or so.

ljvmiranda921 commented 3 years ago

Comment written by Jon on 12/31/2020 03:02:53

You might be able to throw a wrapper over the python code with some code that could utilize the GPU for computational purposes.