[![PyPI version](https://badge.fury.io/py/entity-embeddings-categorical.svg)](https://badge.fury.io/py/entity-embeddings-categorical)
[![Build Status](https://travis-ci.org/bresan/entity_embeddings_categorical.svg?branch=master)](https://travis-ci.org/bresan/entity_embeddings_categorical)
[![Coverage Status](https://coveralls.io/repos/github/bresan/entity_embeddings_categorical/badge.svg?branch=master)](https://coveralls.io/github/bresan/entity_embeddings_categorical?branch=master)
![GitHub](https://img.shields.io/github/license/bresan/entity_embeddings_categorical.svg)

# Overview

This project is aimed to serve as an utility tool for the preprocessing, training and extraction of entity embeddings through Neural Networks using the Keras framework. It's still under construction, so please use it carefully.

# Installation

The installation is pretty simple if you have a virtualenv already installed on your machine. If you don't please rely to [VirtualEnv official documentation](https://virtualenv.pypa.io/en/latest/).

```bash
pip install entity-embeddings-categorical
```

# Usage

The usage of this utility library is provided in two modes: default and custom. In the default configuration, you can perform the following operations: Regression, Binary Classification and Multiclass Classification.

If your data type differs from any of these, you can feel free to use the custom mode, where you can define most of the configurations related to the target processing and output from the neural network.

## Default mode


The usage of the default mode is pretty straightforward, you just need to provide a few parameters to the Config object:

So for creating a simple embedding network that reads from file **sales_last_semester.csv**, where the target name is **total_sales**, with the desired output being a **binary classification** and with a training ratio of **0.9**, our Python script would look like this:

```python
    config = Config.make_default_config(csv_path='sales_last_semester.csv',
                                        target_name='total_sales',
                                        target_type=TargetType.BINARY_CLASSIFICATION,
                                        train_ratio=0.9)


    embedder = Embedder(config)
    embedder.perform_embedding()
```

Pretty simple, huh?

A working example of default mode can be found [here as a Python script](https://github.com/bresan/entity_embeddings_categorical/blob/master/example/default/default_config_example.py).

## Custom mode

If you intend to customize the output of the Neural Network or even the way that the target variables are processed, you need to specify these when creating the configuration object.
This can be done by creating a class that extend from [TargetProcessor](https://github.com/bresan/entity_embeddings_categorical/blob/master/entity_embeddings/processor/processor.py) and [ModelAssembler](https://github.com/bresan/entity_embeddings_categorical/blob/master/entity_embeddings/network/assembler.py).

A working example of custom configuration mode can be found [here](https://github.com/bresan/entity_embeddings_categorical/blob/master/example/custom/custom_config_example.py).

## Visualization

To-DO;

# Documentation



# Testing

This project is inteded to suit most of the existent needs, so for this reason, testability is a major concern. Most of the code is heavily tested, along with [Travis](https://travis-ci.org/bresan/entity_embeddings_categorical) as Continuous Integration tool to run all the unit tests once there is a new commit.

To-Do:

- Notebok sample;
- Visualization;
- Draw CNN;