{"id":27058555,"url":"https://github.com/aclai-lab/piton","last_synced_at":"2025-04-05T12:15:46.277Z","repository":{"id":59971071,"uuid":"373444096","full_name":"aclai-lab/piton","owner":"aclai-lab","description":"Laravel package for rule extraction from MySQL databases","archived":false,"fork":false,"pushed_at":"2022-11-25T14:15:29.000Z","size":342,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-04-01T10:28:39.030Z","etag":null,"topics":["artificial-intelligence","laravel","laravel-6-package","laravel-package","php","rule-extraction"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/aclai-lab.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2021-06-03T09:00:20.000Z","updated_at":"2022-11-21T14:50:36.000Z","dependencies_parsed_at":"2023-01-22T13:00:53.558Z","dependency_job_id":null,"html_url":"https://github.com/aclai-lab/piton","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclai-lab%2Fpiton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclai-lab%2Fpiton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclai-lab%2Fpiton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclai-lab%2Fpiton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aclai-lab","download_url":"https://codeload.github.com/aclai-lab/piton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332595,"owners_count":20921854,"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":["artificial-intelligence","laravel","laravel-6-package","laravel-package","php","rule-extraction"],"created_at":"2025-04-05T12:15:45.617Z","updated_at":"2025-04-05T12:15:46.233Z","avatar_url":"https://github.com/aclai-lab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# piton\nA set of classification learners for the Laravel framework.\n\n# Install\n\nAdd this github project as a repository in composer.json:\n\n```json\n\"repositories\": [\n\t{\n\t\t\"type\": \"vcs\",\n\t\t\"url\": \"https://github.com/aclai-lab/piton\"\n\t}\n]\n\n```\n\nAdd the package in require section:\n\n```json\n\"require\": {\n\t\"aclai/piton\": \"master\"\n}\n```\n\nAnd in the terminal, run the following command:\n\n```\ncomposer update\n```\n\n### Note: for *dev* installation, it is actually more convenient to clone this repo, and tell composer.json to use the cloned repo before running `composer update`:\n\n```json\n\"repositories\": [\n\t{\n\t\t\"type\": \"path\",\n\t\t\"url\": \"{PATH of piton repo}\"\n\t}\n],\n\n...\n\n\"require\": {\n\t\"aclai/piton\": \"dev-master\"\n}\n```\n\n### Config a PITON database\n\npiton is meant to be completely separated from your project, and to save all it's data, especially models, to another database, so a new connection is required.\nTo do so, you have to add a new connection in the 'connections' array of your `config/database.php` file. If you're using MySQL, you can use the following stub.\n```json\n'piton_connection' =\u003e [\n            'driver' =\u003e env('DB_CONNECTION_PITON'),\n            'host' =\u003e env('DB_HOST_PITON', '127.0.0.1'),\n            'port' =\u003e env('DB_PORT_PITON', '3306'),\n            'database' =\u003e env('DB_DATABASE_PITON', 'forge'),\n            'username' =\u003e env('DB_USERNAME_PITON', 'forge'),\n            'password' =\u003e env('DB_PASSWORD_PITON', ''),\n            'unix_socket' =\u003e '',\n            'charset' =\u003e 'utf8mb4',\n            'collation' =\u003e 'utf8mb4_unicode_ci',\n            'prefix' =\u003e '',\n            'prefix_indexes' =\u003e true,\n            'strict' =\u003e true,\n            'engine' =\u003e null,\n        ],\n```\n\nYou also have to add the following to your `.env ` file.\n```json\nDB_CONNECTION_PITON=mysql\nDB_HOST_PITON=127.0.0.1\nDB_PORT_PITON=3306\nDB_DATABASE_PITON=\u003cyour_piton_database\u003e\nDB_USERNAME_PITON=\u003cyour_mysql_username\u003e\nDB_PASSWORD_PITON=\u003cyour_mysql_password\u003e\n```\n\n(Other stubs will be add in the future for full support).\n\nAt the moment, only MySQL is tested and supported.\n\n\n### Migrate Database\n\nNow that we have our package installed, we need to migrate the database to add the necessary tables for piton. In the command line, run the following command.\n\n`php artisan migrate`\n\n### Publish the package config\n\nUp next, you need to publish the package's config file that includes some defaults for us. To publish that, run the following command.\n\n`php artisan vendor:publish --tag=problem-config`\n\nYou will now find the config file located in `/config/problem.php`\n\nThere, you can specify how to build the object of type Instances (basically, a table with metadata) on which you can create rule-based models.\n\n# A simple example\nIf you want to try the package right away, you can run the following command:\n\n`php artisan piton:create_example`\n\nThis will create a table called `Iris` in your database, containing the famous Iris dataframe.\nThen, you'll have to launch the following command:\n\n\n`php artisan vendor:publish --tag=iris-config`\n\nThis will create a file called `iris.php` in your project `config` directory.\nThis config file equals to a problem configuration based on the iris dataframe!\n\nNow, you can try to use one of our learners. For example, let's try to use PRip.\nFirst, we have to publish its configuration file via:\n`php artisan vendor:publish --tag=prip-config`.\n\nYou can now modify `config/prip.php` specifying the options you that prefer; for now, let's keep it as it is.\nWe can now launch the command: `php artisan piton:update_models iris \u003cauthor_id\u003e PRip` which take as parameters the problem to be solved (i.e., the name of the configuration file withouth the .php extension, in this case iris), the author id, the chosen learner and eventually which specific algorithm of the learner (in this case we specify \"Prip\" as the chosen learner).\n\nThis will create as many models as your class attributes (remember that categorical attributes will be forced to be binary, so an attribute with 3 different values will result in 3 separate class attributes, one for each value). In this case, it should create 3 models: one for \"Species_setosa\", one for \"Species_versicolor\" and one for \"Species_virginica\".\n\nWe can now try to predict on these results launching: `php artisan piton:predict_by_identifier` and specifying an identifier.\n\nSuggestion: with the iris dataframe, we sugget using SKLearnLearner CART for accurate predictions. To do so, first publish the config file: `php artisan --tag=sklearn_cart.php` (remember, there's a config file for each \"algorithm\", only \"PRip\" has just one config file) and then run `php artisan piton:update_models  iris \u003cauthor_id\u003e SKLearnLearner CART`.\n\n# Dependencies\n\nIf you want to use the SKLearnLearner and the WittgensteinLearner learners, you also have to make sure that the follow dependencies are on your machine:\n\n- numpy=1.19.2\n- pandas=1.2.3\n- sqlalchemy=1.3.23\n- pymysql=1.0.2\n- scikit-learn=0.24.1\n- wittgenstein==0.2.3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faclai-lab%2Fpiton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faclai-lab%2Fpiton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faclai-lab%2Fpiton/lists"}