Giter Club home page Giter Club logo

mindsdb_recommend's Introduction

This project is based on MindsDB (https://github.com/mindsdb/mindsdb) and MindsDB_sql (https://github.com/mindsdb/mindsdb_sql). The Github repo of our project is at https://github.com/talhz/mindsdb_recommend.

Instructions related to our new syntax

Installation (after git clone this repository)

conda create -n py39 python=3.9
conda activate py39

cd mindsdb
pip3 install -e .
pip install mindsdb[lightwood]
cd ..

cd mindsdb_sql
pip3 install -e .
cd ..

After installation, to directly execute

cd mindsdb
python -m mindsdb

To exit from virtual environment and stop all

conda deactivate

Recommend syntax:

The following query will recommend the suitable model types of the selecting data.

RECOMMEND MODEL project_name.predictor_name
FROM integration_name
    (SELECT column_name, ... FROM table_name)
PREDICT target_column
  • project_name.predictor_name is the name of model we want to create
  • FROM ... is the syntax to get x (sample) data to be used in model
  • PREDICT ... is the syntax to define y (label) data to be used in model

To check the recommendation result, simply use the following query:

DRSCRIBE project_name.predictor_name;

The recommendation result is given in the last column. By default, it provides the top 3 models with highest accuracy. Users can then choose the model at their own discretion.

Parser

Psuedo logic of connections between sql and machine learning related codes

from mindsdb_sql import parse_sql
from mindsdb.api.executor.command_executor import ExecuteCommands

query = parse_sql(sql, dialect="mindsdb")
ret = command_executor.execute_command(query)
  • parse_sql: parse sql query to the mindsdb
  • execute_command: execute the parsed results and return the output

To simply test parser without executing mindsdb in local server:

Make sure that you are in the root directory.

python test.py

To add RECOMMEND related syntax, I changed/added the following files. Search 'recommend' to see where we can add syntax about recommend (in parser.py and lexer.py)

  • mindsdb_sql\mindsdb_sql\parser\dialects\mindsdb\parser.py
  • mindsdb_sql\mindsdb_sql\parser\dialects\mindsdb\lexer.py
  • mindsdb_sql\mindsdb_sql\parser\ast\recommend.py
  • mindsdb_sql\mindsdb_sql\parser\dialects\mindsdb\recommend_model.py

recommend.py and recommend_model.py are the places to interpret semantics and to output interpreted strings. To parse sql query to the mindsdb readable contents, edit recommend.py and recommend_model.py.

This is the code for parsing sql query to mindsdb

To read parsed contents, we need to do some modifications in mindsdb repository.

  • mindsdb\mindsdb\api\mysql\mysql_proxy\executor\mysql_executor.py
  • mindsdb\mindsdb\api\executor\command_executor.py

This is the code for executing the parsed results and return the execution output

mindsdb_recommend's People

Contributors

talhz avatar kyle-biostat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.