Skip to main content

Deep Neural Crossover for EC-KitY

eckity-dnc provides the Deep Neural Crossover (DNC) genetic operator for EC-KitY.

DNC is described in “Deep Neural Crossover: A Multi-Parent Operator That Leverages Gene Correlations” (paper).

Installation

pip install eckity-dnc

Installing eckity-dnc also installs its EC-KitY, PyTorch, NumPy, and SciPy dependencies.

Usage

Import the public API from eckity_dnc:

from eckity.creators import GAIntVectorCreator
from eckity_dnc import (
    DeepNeuralCrossover,
    DeepNeuralCrossoverConfig,
)

Create the vector creator and DNC operator:

population_size = 100
individual_length = 160
number_of_gene_values = 161

individual_creator = GAIntVectorCreator(
    length=individual_length,
    bounds=(0, number_of_gene_values - 1),
)

dnc_config = DeepNeuralCrossoverConfig(
    embedding_dim=64,
    sequence_length=individual_length,
    num_embeddings=number_of_gene_values,
    running_mean_decay=0.95,
    batch_size=1024,
    learning_rate=1e-4,
    use_device="cpu",
    n_parents=2,
    epsilon_greedy=0.3,
)

dnc_operator = DeepNeuralCrossover(
    probability=0.8,
    population_size=population_size,
    dnc_config=dnc_config,
    individual_evaluator=your_eckity_evaluator,
    vector_creator=individual_creator,
)

Add dnc_operator to the EC-KitY subpopulation's operators_sequence. The supplied evaluator must inherit from EC-KitY's SimpleIndividualEvaluator and evaluate vectors created by individual_creator.

See dnc_runner_eckity.py for a complete bin-packing example using tournament selection and mutation.

Compatibility

  • Python 3.10 or newer
  • EC-KitY 0.4.x (tested with 0.4.1)
  • PyTorch 2.7.1 or newer (tested with 2.7.1)
  • NumPy 2.0.2 or newer (tested with 2.0.2)
  • SciPy 1.13.0 or newer (tested with 1.13.0)

Development

Install the package and development tools, then run the tests:

python -m pip install -e ".[dev]"
python -m pytest

Release preparation and manual TestPyPI/PyPI commands are documented in RELEASING.md.

License

This project is licensed under the GNU General Public License v3.0. See LICENSE.

Metadata

Release files for eckity-dnc 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eckity-dnc 0.1.3
File Size Uploaded
eckity_dnc-0.1.3.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eckity-dnc 0.1.3
File Interpreter ABI Platform
eckity_dnc-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / eckity_dnc-0.1.3.tar.gz

Download URL eckity_dnc-0.1.3.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
098a4cacf01e98350b37cdcf51d4c62c32d286fcfaaaddf6cec22e77df54aaa9
BLAKE2b-256 checksum
How to use checksums
07e1c47c828f25b75d388635abe0856f8b32a766c066a0b2bc8ac2ccb0a51f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.13

Release files / eckity_dnc-0.1.3-py3-none-any.whl

Download URL eckity_dnc-0.1.3-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c15f4606e1d9b702ca0d9384635e5c1f5bbdef4569b43ef1c596ccf3a1d372de
BLAKE2b-256 checksum
How to use checksums
53e4a052eadbe431102e98d7001375b95164bb70e6bb22f1475f75ef75b715ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page