Comments (2)
Yes, we currently have a simple guide on how to add a new algorithm. https://evox.readthedocs.io/en/latest/guide/advanced/3-custom-alg-pro.html#example
This guide will introduce the Algorithm
class, which is used to implement new algorithms.
For your case, to implement a typical "cross-entropy method" (from wikipedia)
// Initialize parameters
μ := −6
σ2 := 100
t := 0
maxits := 100
N := 100
Ne := 10
// While maxits not exceeded and not converged
while t < maxits and σ2 > ε do
// Obtain N samples from current sampling distribution
X := SampleGaussian(μ, σ2, N)
// Evaluate objective function at sampled points
S := exp(−(X − 2) ^ 2) + 0.8 exp(−(X + 2) ^ 2)
// Sort X by objective function values in descending order
X := sort(X, S)
// Update parameters of sampling distribution via elite samples
μ := mean(X(1:Ne))
σ2 := var(X(1:Ne))
t := t + 1
// Return mean of final sampling distribution as solution
return μ
You will need to implement the following methods of the Algorithm
class
__init__
setup
initialize μ, σ2 here as thestate
of this algorithm, because these two are changing throughout the iterations.ask
do SampleGaussiantell
do sort, and update μ, σ2 in thestate
I hope this helps.
from evox.
@BillHuang2001 Thanks, I will close this for now.
from evox.
Related Issues (20)
- Monitor: bokeh server, update data while running
- Monitor: dim reduction HOT 1
- Metric
- More plot forms HOT 1
- More test, improve code coverage
- Examples HOT 1
- Problem labels
- Update readme HOT 1
- Update package meta-data
- CSO algorithm's new population is not clipped HOT 2
- Neuroevolution problems: add valid/test evaluate
- `evox` git repository size HOT 3
- Move to Gymnasium and Brax
- Cite EvoJAX and evosax HOT 5
- Quick start example results in AttributeError HOT 2
- Issue of calling dtlz1() HOT 2
- Some problems of cpso_s algorithm HOT 2
- NaN may occur in the CEC2022 SO benchmark HOT 2
- pip安装包不包含workflows包 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evox.