GeneticPy
GeneticPy is an optimizer that uses a genetic algorithm to quickly search through custom parameter spaces for optimal solutions.
Installation
GeneticPy requires Python 3.10+
pip install geneticpy
Development Workflow
This project uses uv for fast dependency management and hatchling as the build backend.
# Run tests
make test
# Build the package
make build
Optimize Example:
A brief example to get you started is included below:
import geneticpy
def loss_function(params):
if params['type'] == 'add':
return params['x'] + params['y']
elif params['type'] == 'multiply':
return params['x'] * params['y']
param_space = {'type': geneticpy.ChoiceDistribution(choice_list=['add', 'multiply']),
'x': geneticpy.UniformDistribution(low=5, high=10, q=1),
'y': geneticpy.GaussianDistribution(mean=0, standard_deviation=1)}
results = geneticpy.optimize(loss_function, param_space, size=200, generation_count=500, verbose=True)
best_params = results.best_params
loss = results.best_score
total_time = results.total_time
PyPi Project
https://pypi.org/project/geneticpy/
Contact
Please feel free to email me at brandonschabell@gmail.com with any questions or feedback.
Metadata
Release files for geneticpy 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geneticpy-2.0.0.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geneticpy-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.4 kB
Release files / geneticpy-2.0.0.tar.gz
| Download URL | geneticpy-2.0.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d44e4faf0c5d5856f68879633ba955de7fbce6b049254a0b900de5cb8611e97
|
|
BLAKE2b-256 checksum How to use checksums |
78062147b6801ba35db5eb5071430c62425adc8d0ac40b3c51af62dbed901564
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / geneticpy-2.0.0-py3-none-any.whl
| Download URL | geneticpy-2.0.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75b91ad98afbc4c0b00b0821bd4ee33532ba6c3c98023d301105aab99b2c6bb7
|
|
BLAKE2b-256 checksum How to use checksums |
8bad56b460408a46d513ef447c349728a8d327b1ddea9e994528cef8951e55cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|