Giter VIP home page Giter VIP logo

db-embedding-tools's Introduction

DB Embedding Tools

Installation

$ pip install -r requirements.txt

Usage

To train the wordvec model given a db, and a set of queries in .sql files in the given directory. Here is a sample execution, with arguments used by me in my setup for a db named imdb, on default settings without any authentication.

$ python3 word2vec_embedding.py --db_host localhost --db_name imdb --sql_dir
new-queries/ --model_name new-wv-nopairs-10.bin --embedding_size 10 --data_dir
PATH/TO/STORE/MODEL/FILES/

There can be any number of sql files in sql_dir which will be executed as is, and each generated row will be treated as a sentence in the learned model after some common preprocessing.

To generate features from the given model, do:

$ mkdir features
$ python3 gen_features.py --data_dir MODEL/LOCATION --model_name
MODEL_YOU_TRAINED_BEFORE --embedding_len EMBEDDING_LEN_USED_FOR_MODEL
--add_count

Notes:

  • For other flags, the default values should all be fine just now. Note: when running on the same data twice, this tries to read it from the disk - so if you cancelled a previous run early, then use flag --regen_sentences.

  • The normal use case is to load everything into memory and then run the wordvec training. This is much faster than using a streaming model from the db (--sentence_gen), or using a file from the disk (--no_pickle). But for processing really large number of rows (50m+ on my setup), I occasionally ran into memory issues with loading everything in.

db-embedding-tools's People

Contributors

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