GithubHelp home page GithubHelp logo

alexstedev / denoisingautoencoders Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 345 KB

๐Ÿ’ก Implementation of Denoising Autoencoders for improved tabular feature representation

Jupyter Notebook 22.65% Python 77.35%
portfolio

denoisingautoencoders's Introduction

Denoising Autoencoders for Improved Tabular Feature Representation

Overview

Denoising AutoEncoders (DAE)

DAEs are AutoEncoder models trained to perform a denoising task. The model takes a partially corrupted input data and learns to clean and output the cleaned data.

Through the denoising task, the model learns the input distribution and produces latent representations that are robust to corruptions. The latent representations extracted from the model can be useful for a variety of downstream tasks. One can:

  1. Freeze the encoder layers and use the latent representations to train supervised ML models, rendering DAE as a vehicle for automatic feature engineering.
  2. Use the latent representations for unsupervised tasks like similarity query or clustering.

Applying Denoising AutoEncoders to tabular data

To train DAEs on tabular data, the most important piece is the noise generator. What makes sense and most effective is swap noise, through which each value in the training data maybe replaced by a random value from the same column.

What's included

This package implements:

  1. Swap Noise generator.
  2. Dataframe parser which converts arbitrary pandas dataframe to numpy arrays.
  3. Network constructor with configurable body blocks.
  4. Training function.
  5. Sklearn style .fit, .transform API.
  6. Sklearn style model also supports save and load.

Installation

tabdae is built with PyTorch. Make sure to install the dependencies listed in requirements.txt. Then install the package using pip:

pip install -r requirements.txt
pip install git+https://github.com/alexstedev/DenoisingAutoencoders.git

Quickstart

import pandas as pd
from tabdae.models.model import DAE

df = pd.read_csv(<path-to-csv-file>)

dae = DAE(
    body_network='deepstack',
    body_network_cfg=dict(hidden_size=1024),
    swap_noise_probas=.15,
    device='cuda',
)  

dae.fit(df, verbose=1, optimizer_params={'lr': 3e-4})

# extract latent representation with the model
latent = dae.transform(df)

Credit

While I haven't been able to find an article introducing this method, it has won several Kaggle competitions, e.g. Porto Seguro's safe driver prediction and Tabular Playground Series - Feb 2021.

denoisingautoencoders's People

Contributors

serteal avatar

Stargazers

Aviv Nur avatar

Watchers

 avatar

Forkers

avivnur

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.