{"id":30548488,"url":"https://github.com/jespb/python-gsgp","last_synced_at":"2025-08-28T03:08:06.655Z","repository":{"id":132774084,"uuid":"220468767","full_name":"jespb/Python-GSGP","owner":"jespb","description":"My implementarion of the Geometric Semantic Genetic Programming (GSGP) algorithm.","archived":false,"fork":false,"pushed_at":"2023-10-03T09:10:39.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-10-03T20:34:46.379Z","etag":null,"topics":["binary-classification","classification","evolutionary-algorithms","evolutionary-computation","genetic-programming","machine-learning","regression","regression-models","semantics"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jespb.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-11-08T13:07:02.000Z","updated_at":"2023-09-30T10:20:51.000Z","dependencies_parsed_at":"2023-09-23T15:39:08.111Z","dependency_job_id":null,"html_url":"https://github.com/jespb/Python-GSGP","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/jespb/Python-GSGP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespb%2FPython-GSGP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespb%2FPython-GSGP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespb%2FPython-GSGP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespb%2FPython-GSGP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jespb","download_url":"https://codeload.github.com/jespb/Python-GSGP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespb%2FPython-GSGP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272426365,"owners_count":24933024,"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","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["binary-classification","classification","evolutionary-algorithms","evolutionary-computation","genetic-programming","machine-learning","regression","regression-models","semantics"],"created_at":"2025-08-28T03:08:05.959Z","updated_at":"2025-08-28T03:08:06.632Z","avatar_url":"https://github.com/jespb.png","language":"Python","readme":"By using this file, you are agreeing to this product's EULA\nThis product can be obtained in https://github.com/jespb/Python-GSGP\nCopyright ©2019 J. E. Batista\n\n\nThis implementation of GSGP uses the following command and flags:\n\n$ python Main_GSGP.py\n\t\n\t[-d datasets] \n\t\t- This flag expects a set of csv dataset names separated by \";\" (e.g., a.csv;b.csv)\n\t\t- By default, the heart.csv dataset is used\t\t\n\n\t[-dontshuffle]\n\t\t- By using this flag, the dataset will not be shuffled;\n\t\t- By default, the dataset is shuffled.\n\n\t[-dsdir dir] \n\t\t- States the dataset directory. \n\t\t- By default \"datasets/\" is used \n\t\t- Use \"-dsdir ./\" for the root directory\t\n\n\t[-es elite_size]\n\t\t- This flag expects an integer with the elite size;\n\t\t- By default, the elite has size 1.\n\n\t[-md max_depth]\n\t\t- This flag expects an integer with the maximum initial depth for the trees;\n\t\t- By default, this value is set to 6.\t\t\n\n\t[-mg max_generation]\n\t\t- This flag expects an integer with the maximum number of generations;\n\t\t- By default, this value is set to 1000.\n\t\n\t[-ms mutation_step]\n\t\t- This flag expects a float with the mutation step size;\n\t\t- By default, the mutation step used is 0.1\n\n\t[-odir dir] \n\t\t- States the output directory. \n\t\t- By default \"results/\" is used \n\t\t- Use \"-odir ./\" for the root directory\n\t\n\t[-op operators]\n\t\t- This flag excepts a set of operators separated by \";\"\n\t\t- Allowed operators: +;-;*;/\n\t\t- By default, the used operators are the sum, subtraction, multiplication and protected division.\t\t\n\n\t[-ps population_size]\n\t\t- This flag expects an integer with the size of the population;\n\t\t- By default, this value is set to 500.\n\n\t[-r] \n\t\t- States the this is a regression problem. \n\t\t- By default the GSGP tries to classify samples as 0 or 1\n\n\t[-runs number_of_runs] \n\t\t- This flag expects an integer with the number of runs to be made;\n\t\t- By default, this values is set to 30\n\t\n\t[-tf train_fraction]\n\t\t- This flag expects a float [0;1] with the fraction of the dataset to be used in training;\n\t\t- By default, this value is set to 0.70\n\t\n\t[-ts tournament_size]\n\t\t- This flag expects an integer with the tournament size;\n\t\t- By default, this value is set to 10.\n\n\n\nHow to import this implementation to your project:\n    - Download this repository;\n    - Copy the \"gsgp/\" directory to your project directory;\n    - import the GSGP class using \"from gsgp.GSGP import GSGP\".\n\nHow to use this implementation:\n    $ from gsgp.GSGP import GSGP\n    $ model = GSGP()\n    $ model.fit( training_x, training_y, test_x (optional), test_y (optional) \n\n\n\nArguments for M3GP():\n    operators\t\t\t-\u003e Operators used by the individual (default: [(\"+\",2),(\"-\",2),(\"*\",2),(\"/\",2)] )\n    max_initial_depth\t-\u003e Max initial depths of the individuals (default: 6)\n    population_size\t\t-\u003e Population size (default: 500)\n    max_generation\t\t-\u003e Maximum number of generations (default: 1000)\n    tournament_size\t\t-\u003e Tournament size (default: 5)\n    elitism_size\t\t-\u003e Elitism selection size (default: 1)\n    mutation_step\t\t-\u003e Mutation step value (default: 0.1)\n    threads \t\t\t-\u003e Number of CPU threads to be used (default: 1)\n    random_state\t\t-\u003e Random state (default: 42)\n    verbose\t\t\t\t-\u003e Console prints during training (default: True)\n\n\nArguments for model.fit():\n    Tr_X \t\t-\u003e Training samples\n    Tr_Y \t\t-\u003e Training labels\n    Te_X \t\t-\u003e Test samples, used in the standalone version (default: None)\n    Te_Y \t\t-\u003e Test labels, used in the standalone version (default: None)\n\n\nUseful methods:\n    $ model = GSGP()\t-\u003e starts the model;\n    $ model.fit(X, Y)\t-\u003e fits the model to the dataset;\n    $ model.predict(X)\t-\u003e Returns a list with the prediction of the given dataset. (use after training)\n\n\n\n\nHow to edit this implementation:\n    Fitness Function ( gsgp.Individual ):\n        - Change the getFitness() method to use your own fitness function;\n        - This implementation assumes that a higher fitness is always better. To change this, edit the __gt__ method in this class.\n\n\n\n\n\nReference:\n    Moraglio A., Krawiec K., Johnson C.G. (2012) Geometric Semantic Genetic Programming. In: Coello C.A.C., Cutello V., Deb K., Forrest S., Nicosia G., Pavone M. (eds) Parallel Problem Solving from Nature - PPSN XII. PPSN 2012. Lecture Notes in Computer Science, vol 7491. Springer, Berlin, Heidelberg\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjespb%2Fpython-gsgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjespb%2Fpython-gsgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjespb%2Fpython-gsgp/lists"}