{"id":13784386,"url":"https://github.com/AIworx-Labs/chocolate","last_synced_at":"2025-05-11T19:32:54.788Z","repository":{"id":43642916,"uuid":"79951380","full_name":"AIworx-Labs/chocolate","owner":"AIworx-Labs","description":"A fully decentralized hyperparameter optimization framework","archived":false,"fork":false,"pushed_at":"2024-07-18T16:11:48.000Z","size":2443,"stargazers_count":121,"open_issues_count":22,"forks_count":41,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-11-14T10:41:45.197Z","etag":null,"topics":["bayesian-optimization","cmaes","conditional-search-space","hyperparameter-optimization","optimization","parallelism"],"latest_commit_sha":null,"homepage":"http://chocolate.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AIworx-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-24T20:31:38.000Z","updated_at":"2024-11-10T02:13:10.000Z","dependencies_parsed_at":"2024-08-03T19:03:07.592Z","dependency_job_id":"8f3f4a90-7b0c-47f2-b7ba-f76dee4a1afd","html_url":"https://github.com/AIworx-Labs/chocolate","commit_stats":null,"previous_names":["novasyst/chocolate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIworx-Labs%2Fchocolate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIworx-Labs%2Fchocolate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIworx-Labs%2Fchocolate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIworx-Labs%2Fchocolate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AIworx-Labs","download_url":"https://codeload.github.com/AIworx-Labs/chocolate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225086615,"owners_count":17418764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-optimization","cmaes","conditional-search-space","hyperparameter-optimization","optimization","parallelism"],"created_at":"2024-08-03T19:00:41.905Z","updated_at":"2024-11-17T20:31:53.690Z","avatar_url":"https://github.com/AIworx-Labs.png","language":"Python","funding_links":[],"categories":["Scheduling"],"sub_categories":[],"readme":"# Chocolate\nChocolate is a **completely asynchronous** optimisation framework relying solely on a\ndatabase to share information between workers. Chocolate uses **no master process** for\ndistributing tasks. Every task is completely independent and only gets its\ninformation from a database. Chocolate is thus ideal in controlled computing\nenvironments where it is hard to maintain a master process for the duration\nof the optimisation.\n\nChocolate has been designed and optimized for hyperparameter optimization where\neach function evaluation takes very long to complete and is difficult to parallelize.\nChocolate allows optimization over **conditional search spaces** either as using\nconditional kernels in a Bayesian optimizer or as a multi-armed bandit problem using\nThompson sampling. Chocolate also handles **multi-objective optimisation** where\nmultiple loss funtions are optimized simultaneously.\n\nChocolate provides the following sampling/searching algorithms:\n- Grid\n- Random\n- QuasiRandom\n- CMAES\n- MOCMAES\n- Bayesian\n\nand three useful backends:\n- SQlite\n- MongoDB\n- Pandas Data Frame\n\nChocolate is licensed under the [3-Clause BSD License](http://opensource.org/licenses/BSD-3-Clause)\n\n## Documentation\n\nThe full documentation is available at\nhttp://chocolate.readthedocs.io.\n\n## Installation\n\nChocolate is installed using [pip](http://www.pip-installer.org/en/latest/),\nunfortunately we don't have any PyPI package yet. Here is the line you have to type\n\n`pip install git+https://github.com/AIworx-Labs/chocolate@master`\n\n## Dependencies\n\nChocolate has various dependencies. While the optimizers depends on NumPy,\nSciPy and Scikit-Learn, the SQLite database connection depends on dataset and \nfilelock and the MongoDB database connection depends on PyMongo. Some utilities\ndepend on pandas. All but PyMongo will be installed with Chocolate.\n\n## Simple example\n\nThe following very simple example shows how to optimize a conditional search space in\nChocolate. You'll note that a single point is sampled and evaluated in the script. Since\nthe database connections are 'parallel' safe, you can run this script in concurrent processes\nand achieve maximum parallelism. \n\n```python\nimport chocolate as choco\n\ndef objective_function(condition, x=None, y=None):\n    \"\"\"An objective function returning ``1 - x`` when *condition* is 1 and \n    ``y - 6`` when *condition* is 2.\n    \n    Raises:\n        ValueError: If condition is different than 1 or 2.\n    \"\"\"\n    if condition == 1:\n        return 1 - x\n    elif condition == 2:\n        return y - 6\n    raise ValueError(\"condition must be 1 or 2, got {}.\".format(condition))\n\n# Define the conditional search space \nspace = [\n            {\"condition\": 1, \"x\": choco.uniform(low=1, high=10)},\n            {\"condition\": 2, \"y\": choco.log(low=-2, high=2, base=10)}\n        ]\n\n# Establish a connection to a SQLite local database\nconn = choco.SQLiteConnection(\"sqlite:///my_db.db\")\n\n# Construct the optimizer\nsampler = choco.Bayes(conn, space)\n\n# Sample the next point\ntoken, params = sampler.next()\n\n# Calculate the loss for the sampled point (minimized)\nloss = objective_function(**params)\n\n# Add the loss to the database\nsampler.update(token, loss)\n```\n\nHave a look at the [documentation](http://chocolate.readthedocs.io) tutorials for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAIworx-Labs%2Fchocolate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAIworx-Labs%2Fchocolate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAIworx-Labs%2Fchocolate/lists"}