https://github.com/geneticpy/geneticpy
GeneticPy is an optimizer that uses a genetic algorithm to quickly search through custom parameter spaces for optimal solutions.
https://github.com/geneticpy/geneticpy
genetic-algorithm hyperparameter-optimization optimization python
Last synced: 6 months ago
JSON representation
GeneticPy is an optimizer that uses a genetic algorithm to quickly search through custom parameter spaces for optimal solutions.
- Host: GitHub
- URL: https://github.com/geneticpy/geneticpy
- Owner: geneticpy
- License: mit
- Created: 2018-12-02T21:25:20.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-09-03T23:56:45.000Z (almost 2 years ago)
- Last Synced: 2025-09-15T02:26:51.001Z (10 months ago)
- Topics: genetic-algorithm, hyperparameter-optimization, optimization, python
- Language: Python
- Homepage:
- Size: 75.2 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GeneticPy
[](https://codecov.io/gh/geneticpy/geneticpy)
[](https://badge.fury.io/py/geneticpy)
[](https://pypi.python.org/pypi/geneticpy/)
[](https://pepy.tech/projects/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+
```sh
pip install geneticpy
```
### Development Workflow
This project uses [uv](https://github.com/astral-sh/uv) for fast dependency management and [hatchling](https://github.com/pypa/hatch) as the build backend.
```sh
# Run tests
make test
# Build the package
make build
```
### Optimize Example:
A brief example to get you started is included below:
```python
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.