Skip to main content

Democritus functions for working with algorithms.

Project description

Democritus Algorithms (a.k.a. d8s-algorithms)

PyPI CI Lint codecov The Democritus Project uses semver version 2.0.0 The Democritus Project uses black to format code License: LGPL v3

Democritus functions[1] for working with algorithms.

[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.

We use d8s as an abbreviation for democritus (you can read more about this here).

Installation

pip install d8s-algorithms

Functions

  • def amb(validation_function: Callable[..., bool], *args: Any) -> Iterable[Any]:
        """."""
    
  • def depth_first_traverse(
        data: Any,
        get_children_function: Callable[[Any], Optional[Iterable]],
        *,
        collect_items_function: Optional[Callable[[Any], Any]] = None
    ) -> Iterable[Any]:
        """Traverse the data in a depth-first manner.
    
    The get_children_function specifies how children will be identified from each node of the data.
    The collect_items_function, if provided, allows you to collect items from the data by...
     returning them from the collect_items_function."""
    
  • def breadth_first_traverse(
        data: Any,
        get_children_function: Callable[[Any], Optional[Iterable]],
        *,
        collect_items_function: Optional[Callable[[Any], Any]] = None
    ) -> Iterable[Any]:
        """Traverse the data in a breadth-first manner.
    
    The get_children_function specifies how children will be identified from each node of the data.
    The collect_items_function, if provided, allows you to collect items from the data by...
     returning them from the collect_items_function."""
    
  • def genetic_algorithm_run(
        data: Iterable[Any],
        scoring_function: Callable[[Any], Union[int, float]],
        selection_function: Callable[[Dict[Any, Union[int, float]]], Iterable[Any]],
        mutation_function: Callable[[Iterable[Any]], Iterable[Any]],
        max_epochs: int,
    ) -> Dict[Any, Union[int, float]]:
        """."""
    
  • def genetic_algorithm_best_mutation_function(
        starting_values: Iterable[Any],
        generations: int,
        scoring_function: Callable[[Any], Union[int, float]],
        mutation_functions: List[Callable[[Any], Any]],
    ):
        """Find the best mutation function.
    
    The best function is the one which produces values from the starting values...
     that score the highest (as measured by the scoring_function) after generations."""
    

Development

👋  If you want to get involved in this project, we have some short, helpful guides below:

If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.

Credits

This package was created with Cookiecutter and Floyd Hightower's Python project template.

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

d8s_algorithms-0.6.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

d8s_algorithms-0.6.2-py2.py3-none-any.whl (21.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file d8s_algorithms-0.6.2.tar.gz.

File metadata

  • Download URL: d8s_algorithms-0.6.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_algorithms-0.6.2.tar.gz
Algorithm Hash digest
SHA256 34c6cd99c02f59f0a044665f1c97b0aac121c0b3d18cc4f4dd2d71edbd7c453b
MD5 fa2cf48512ed6788c9541615da6cb9d3
BLAKE2b-256 8f328ca38049d915bddcb75325a6effa9974393f1ca0b53ddb76021986d4a14d

See more details on using hashes here.

File details

Details for the file d8s_algorithms-0.6.2-py2.py3-none-any.whl.

File metadata

  • Download URL: d8s_algorithms-0.6.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_algorithms-0.6.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0a5ba6c9ac8aade4f7956de7357b91bc62fddf73e6ec1c19b466237b7320f121
MD5 4511a09204a57059f236aaf0f1d24d5b
BLAKE2b-256 64016ba059cf07c4f2a0151c7ba7b2fbfbe5229ef91f5b47cffb8060dc678cab

See more details on using hashes here.

Supported by

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