{"id":17508212,"url":"https://github.com/iraikov/distgfs","last_synced_at":"2025-03-25T18:44:00.454Z","repository":{"id":65681984,"uuid":"239612995","full_name":"iraikov/distgfs","owner":"iraikov","description":"Parallel optimizer based on the Global Function Search","archived":false,"fork":false,"pushed_at":"2024-03-22T21:44:45.000Z","size":210,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-14T09:28:41.478Z","etag":null,"topics":["distributed-optimization","mpi-applications","optimization-framework","optimization-library","optimization-tools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iraikov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-02-10T21:04:47.000Z","updated_at":"2024-07-17T16:53:45.287Z","dependencies_parsed_at":"2024-07-17T16:53:39.141Z","dependency_job_id":"1a07dffc-ce5c-49da-954d-fa3bd535bd96","html_url":"https://github.com/iraikov/distgfs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fdistgfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fdistgfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fdistgfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fdistgfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iraikov","download_url":"https://codeload.github.com/iraikov/distgfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245525863,"owners_count":20629832,"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":["distributed-optimization","mpi-applications","optimization-framework","optimization-library","optimization-tools"],"created_at":"2024-10-20T04:18:12.333Z","updated_at":"2025-03-25T18:44:00.434Z","avatar_url":"https://github.com/iraikov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# distgfs\n\nDistributed computing framework for the\n[Global Function Search](http://dlib.net/optimization.html#global_function_search) \n(GFS) hyperparameter optimizer from the [Dlib](http://dlib.net) library.\nBased on [gfsopt](https://github.com/tsoernes/gfsopt).\n\nProvides the following features:\n* Parallel optimization: Run distributed hyperparameter searches via [mpi4py](https://github.com/mpi4py/mpi4py).\n* Save and restore progress: Save/restore settings, parameters and optimization progress to/from HDF5 file. \n* Average over multiple runs: Run a stochastic objective function using the same\nparameters multiple times and report the average to Dlib's Global Function\nSearch. Useful in highly stochastic domains to avoid biasing the search towards\nlucky runs.\n\nFor theoretical background of GFS, see ['A Global Optimization Algorithm Worth Using'](http://blog.dlib.net/2017/12/a-global-optimization-algorithm-worth.html) and [Malherbe \u0026 Vayatis 2017: Global optimization of Lipschitz functions](https://arxiv.org/abs/1703.02628)\n\n# Example usage\nA basic example where we maximize Levi's function with as many parallel processes as there are logical cores, and save progress to file.\n\n```python\nimport math, distgfs\n\ndef levi(x, y):\n    \"\"\"\n    Levi's function (see https://en.wikipedia.org/wiki/Test_functions_for_optimization).\n    Has a global _minimum_ of 0 at x=1, y=1.\n    \"\"\"\n    a = math.sin(3. * math.pi * x)**2\n    b = (x - 1)**2 * (1 + math.sin(3. * math.pi * y)**2)\n    c = (y - 1)**2 * (1 + math.sin(2. * math.pi * y)**2)\n    return a + b + c\n\n\ndef obj_fun(pp, pid):\n    \"\"\" Objective function to be _maximized_ by GFS. \"\"\"\n    x = pp['x']\n    y = pp['y']\n\n    res = levi(0.4*x, y)\n    print(f\"Iter: {pid}\\t x:{x}, y:{y}, result:{res}\")\n    # Since Dlib maximizes, but we want to find the minimum,\n    # we negate the result before passing it to the Dlib optimizer.\n    return -res\n\n# For this example, we pretend that we want to keep 'y' fixed at 1.0\n# while optimizing 'x' in the range -4.5 to 4.5\nspace = {'x': [-4.5, 4.5]}\nproblem_parameters = {'y': 1.}\n    \n# Create an optimizer parameter set\ndistgfs_params = {'opt_id': 'distgfs_levi',\n                  'obj_fun_name': 'obj_fun',\n                  'obj_fun_module': 'example_distgfs_levi_file',\n                  'problem_parameters': problem_parameters,\n                  'space': space,\n                  'n_iter': 10,\n                  'file_path': 'distgfs.levi.h5',\n                  'save': True,\n                 }\n\ndistgfs.run(distgfs_params, verbose=True)\n```\n\nFor additional examples, see [examples](https://github.com/iraikov/distgfs/tree/master/examples).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fdistgfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firaikov%2Fdistgfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fdistgfs/lists"}