{"id":21291582,"url":"https://github.com/smartdataanalytics/autochef","last_synced_at":"2025-06-21T04:43:04.515Z","repository":{"id":145428429,"uuid":"263994024","full_name":"SmartDataAnalytics/AutoChef","owner":"SmartDataAnalytics","description":"Automated recipe generator","archived":false,"fork":false,"pushed_at":"2020-05-15T08:09:33.000Z","size":35713,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-15T16:36:05.819Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/SmartDataAnalytics.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-05-14T18:28:04.000Z","updated_at":"2024-08-28T14:13:38.000Z","dependencies_parsed_at":"2023-06-26T07:45:10.861Z","dependency_job_id":null,"html_url":"https://github.com/SmartDataAnalytics/AutoChef","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SmartDataAnalytics/AutoChef","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2FAutoChef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2FAutoChef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2FAutoChef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2FAutoChef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartDataAnalytics","download_url":"https://codeload.github.com/SmartDataAnalytics/AutoChef/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2FAutoChef/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261064629,"owners_count":23104729,"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":[],"created_at":"2024-11-21T13:36:20.559Z","updated_at":"2025-06-21T04:42:59.495Z","avatar_url":"https://github.com/SmartDataAnalytics.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoChef\n\nAn Evolutionary Algortihm to create new cooking recipes\n\n## requirements\n\n* an envrironment with python3.7.\n* For python3.8 or newer the adjacency matrices have to be created manually from the 1M Recipe Dataset as described in the package details below\n\n## installation\n\n* clone this directory: `https://github.com/SmartDataAnalytics/AutoChef.git`\n* inside the cloned project, extract the pregenerated compressed adjacency matrices with\n\n```\ncd src/autochef/RecipeAnalysis \u0026\u0026 tar -xf adjacency_matrices.tar.xz\n```\n\n* install the cloned package with pip:\n\n```bash\npip install wheel\npip install ./AutoChef\n```\n\n## Example Usage:\n\njust perform the following in a jupyter notebook (same as [Example.ipynb](Example.ipynb))\n\n**Import autochef's Evolutionary Algorithm**\n\n```python\nimport autochef\nfrom autochef.EvolutionaryAlgorithm import EvolutionaryAlgorithm as EA\n```\n\n**Setup parameters**\n\n```python\n# define the set of input ingredients and it's subset of main ingredients\n\nall_ingredients = [\"bread\", \"butter\"]\nmain_ingredients = [\"bread\"]\n\n# define range of additional ingredients\nmin_add = 4\nmax_add = 13\n\n# population size:\nn_pop = 50\n\n# mutations rate (given in number of node mutations for each tree)\nmutations = 2\n\n# if pairwise competition is false, just the best n_pop/2 individuals survive\npairwise_competition = True\n```\n\n**build initial population**\n\n```python\np = EA.Population(\n    all_ingredients,\n    main_ingredients,\n    min_additional=min_add,\n    max_additional=max_add,\n    n_population = n_pop,\n    mutations=mutations,\n    pairwise_competition=pairwise_competition\n)\n```\n\n**run over a given number of generations**\n\n```python\n# run over 10 cycles\nfitness_logs = p.run(10)\n```\n\n**plot best 3 individuals**\n\n```python\np.plot_population(n_best=3)\n```\n\n## Package Details\n\nif you want to modify package data, retrain models or recreate adjacency matrices: here are some notes about the structure of this package (in `/src/autochef/`):\n\n### `./data`\n\nthe `./data` folder contains data files used in this thesis.\n\n**NOTE**: due to the [1M_recipes](http://pic2recipe.csail.mit.edu/) licensing, i am not allowed to redistribute it's data. Because of this the data has to be downloaded manually and put indside the folder [`./data/1M_recipes`](./src/autochef/data/1M_recipes/).\n\n### `./db`\n\nTools to create a mariadb recipe database from the 1M_recipes dataset and working with it. Necessary if you want to recreate adjacency matrices. To create a docker image with a database containing the 1M_recipe dataset execute the following Notebooks:\n\n* [`./db/create_database_docker.ipynb`](src/autochef/db/create_database_docker.ipynb)\n  \n  * creating a docker image with mariadb\n\n* [`./db/create_database.ipynb`](src/autochef/db/create_database.ipynb)\n  \n  * filling the created database with the 1M_recipe dataset\n\n### `./Tagging`\n\n(needs the 1M_recipe dataset placed inside the data folder, see above)\n\nTools to retrain the crf classifier. The package ships already a trained one.\n\nTo generate a train dataset for the crf classifier run the python script:\n\n* [`recipe_conllu_generator.py`](src/autochef/Tagging/recipe_conllu_generator.py)\n\nit will generate enumerated `*.conllu` files which can then used to train the classifier with \n\n* [`CRF_training.ipynb`](src/autochef/Tagging/CRF_training.ipynb)\n\n\n\n### `./RecipeAnalysis`\n\n(needs the maria database set up and filled with data)\n\ntools to generate adjacency Matrices. To generate them run the Notebooks\n\n* [`MatrixGeneration.ipynb`](src/autochef/RecipeAnalysis/MatrixGeneration.ipynb)\n\nand \n\n* [`AdjacencyMatrixRefinement.ipynb`](src/autochef/RecipeAnalysis/AdjacencyMatrixRefinement.ipynb)\n\n\n\nthe matrices are then serialized and saved with [dill]([dill · PyPI](https://pypi.org/project/dill/)) and can be loaded with dill again (which is done in the Evolutionary algorithm)\n\n\n\n### `./EvolutionaryAlgorithm`\n\nneeds adjaceny matrices set up in the recipe analysis folder. The package already ships with pregenerated ones, so that you can try the evolutionary algorithm without setting up the 1M recipe database if you only want to run this part. Core Part is the `EvolutionaryAlgorithm.py` module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartdataanalytics%2Fautochef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartdataanalytics%2Fautochef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartdataanalytics%2Fautochef/lists"}