Skip to main content

GeneticPy is an optimizer that uses a genetic algorithm to quickly search through custom parameter spaces for optimal solutions.

Project description

GeneticPy

codecov PyPI version PyPI pyversions PyPI Downloads

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geneticpy-2.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geneticpy-2.0.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file geneticpy-2.0.0.tar.gz.

File metadata

  • Download URL: geneticpy-2.0.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geneticpy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 4d44e4faf0c5d5856f68879633ba955de7fbce6b049254a0b900de5cb8611e97
MD5 8ca399730201829cc2f1bcffbaf77ec8
BLAKE2b-256 78062147b6801ba35db5eb5071430c62425adc8d0ac40b3c51af62dbed901564

See more details on using hashes here.

File details

Details for the file geneticpy-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: geneticpy-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geneticpy-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75b91ad98afbc4c0b00b0821bd4ee33532ba6c3c98023d301105aab99b2c6bb7
MD5 ebae8cd0722882cd8d6bdd6b3d816188
BLAKE2b-256 8bad56b460408a46d513ef447c349728a8d327b1ddea9e994528cef8951e55cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page