https://github.com/aclai-lab/piton

Laravel package for rule extraction from MySQL databases

https://github.com/aclai-lab/piton

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

artificial-intelligence laravel laravel-6-package laravel-package php rule-extraction
Last synced: 6 months ago · JSON representation

Repository

Laravel package for rule extraction from MySQL databases

Basic Info
  • Host: GitHub
  • Owner: aclai-lab
  • Language: PHP
  • Default Branch: master
  • Homepage:
  • Size: 334 KB
Statistics
  • Stars: 5
  • Watchers: 4
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Archived
Topics
artificial-intelligence laravel laravel-6-package laravel-package php rule-extraction
Created over 4 years ago · Last pushed about 3 years ago
Metadata Files
Readme

README.md

piton

A set of classification learners for the Laravel framework.

Install

Add this github project as a repository in composer.json:

```json "repositories": [ { "type": "vcs", "url": "https://github.com/aclai-lab/piton" } ]

```

Add the package in require section:

json "require": { "aclai/piton": "master" }

And in the terminal, run the following command:

composer update

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:

```json "repositories": [ { "type": "path", "url": "{PATH of piton repo}" } ],

...

"require": { "aclai/piton": "dev-master" } ```

Config a PITON database

piton 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. To 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. json 'piton_connection' => [ 'driver' => env('DB_CONNECTION_PITON'), 'host' => env('DB_HOST_PITON', '127.0.0.1'), 'port' => env('DB_PORT_PITON', '3306'), 'database' => env('DB_DATABASE_PITON', 'forge'), 'username' => env('DB_USERNAME_PITON', 'forge'), 'password' => env('DB_PASSWORD_PITON', ''), 'unix_socket' => '', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, ],

You also have to add the following to your .env file. json DB_CONNECTION_PITON=mysql DB_HOST_PITON=127.0.0.1 DB_PORT_PITON=3306 DB_DATABASE_PITON=<your_piton_database> DB_USERNAME_PITON=<your_mysql_username> DB_PASSWORD_PITON=<your_mysql_password>

(Other stubs will be add in the future for full support).

At the moment, only MySQL is tested and supported.

Migrate Database

Now 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.

php artisan migrate

Publish the package config

Up next, you need to publish the package's config file that includes some defaults for us. To publish that, run the following command.

php artisan vendor:publish --tag=problem-config

You will now find the config file located in /config/problem.php

There, you can specify how to build the object of type Instances (basically, a table with metadata) on which you can create rule-based models.

A simple example

If you want to try the package right away, you can run the following command:

php artisan piton:create_example

This will create a table called Iris in your database, containing the famous Iris dataframe. Then, you'll have to launch the following command:

php artisan vendor:publish --tag=iris-config

This will create a file called iris.php in your project config directory. This config file equals to a problem configuration based on the iris dataframe!

Now, you can try to use one of our learners. For example, let's try to use PRip. First, we have to publish its configuration file via: php artisan vendor:publish --tag=prip-config.

You can now modify config/prip.php specifying the options you that prefer; for now, let's keep it as it is. We can now launch the command: php artisan piton:update_models iris <author_id> 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).

This 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 "Speciessetosa", one for "Speciesversicolor" and one for "Species_virginica".

We can now try to predict on these results launching: php artisan piton:predict_by_identifier and specifying an identifier.

Suggestion: 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 <author_id> SKLearnLearner CART.

Dependencies

If you want to use the SKLearnLearner and the WittgensteinLearner learners, you also have to make sure that the follow dependencies are on your machine:

  • numpy=1.19.2
  • pandas=1.2.3
  • sqlalchemy=1.3.23
  • pymysql=1.0.2
  • scikit-learn=0.24.1
  • wittgenstein==0.2.3

Owner

  • Name: Applied Computational Logic and Artificial Intelligence Laboratory
  • Login: aclai-lab
  • Kind: organization
  • Email: aclai@unife.it
  • Location: Italy

Applied Computational Logic and Artificial Intelligence (ACLAI) Laboratory of the Department of Mathematics and Computer Science, University of Ferrara

GitHub Events

Total
Last Year

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 87
  • Total Committers: 3
  • Avg Commits per committer: 29.0
  • Development Distribution Score (DDS): 0.46
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alberto Paparella a****a@e****t 47
giopaglia 2****a 35
aclai-lab 8****b 5
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

composer.json packagist
  • orchestra/testbench ^6.17 development
  • doctrine/dbal 2.10.0
  • ext-json *