Democritus functions for working with algorithms.
Project description
Democritus Algorithms (a.k.a. d8s-algorithms)
Democritus functions[1] for working with algorithms.
[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.
We use d8s
(pronounced "dee-eights") as an abbreviation for democritus
(you can read more about this here).
Installation
pip install d8s-algorithms
Usage
You import the library like:
from d8s_algorithms import *
Once imported, you can use any of the functions listed below.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file d8s_algorithms-0.7.0.tar.gz
.
File metadata
- Download URL: d8s_algorithms-0.7.0.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 594d99f9c8d17148bb5ce4c8fa32839a2e069e92d250af5ec66df10c0fa2b2b9 |
|
MD5 | 9cac90ac2d48f28589afdab8d1c136e1 |
|
BLAKE2b-256 | 331d01a85d279c4419a83ea50050a81121528dc84ab9815bc0d8b9e931ec4f14 |
File details
Details for the file d8s_algorithms-0.7.0-py2.py3-none-any.whl
.
File metadata
- Download URL: d8s_algorithms-0.7.0-py2.py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 323d0f8b95f1143c09bd13c476d89348b8d37fff1456ffa2a7ebd715cac42546 |
|
MD5 | 8c4d19eccb3ccbbe579f5797f032f2bb |
|
BLAKE2b-256 | 899ea66b85250756c37748b4cbb467ca502fe2dded213e74459670858078d731 |