Skip to main content

A tool to convert tabular data into images, in order to be used by CNN. Inspired by the 'DeepInsight' paper.

Project description

Tab2Img: from tabular data to images

A tool to convert tabular data into images for CNN. Inspired by the DeepInsight paper.

Installation

pip install tab2img

Background

In the paper "DeepInsight: A methodology to transform a non-image data to an image for convolution neural network architecture" the autors propose a method to convert tabular data into images, in order to utilize the power of convolutional neural network (CNN) for non-image structured data.

The Figure illustrates the main idea: given a training dataset equation with equation samples and equation features, we are required to find a function equation, where equation.

There are numerous ways to choose equation. In this implementation, the features are organized with respect to the correlation vector equation, where equation is the target vector. Given equation and equation as

the vector equation express the Pearson correlation coefficient*

where

At this point equation is sorted from the greatest to the smallest, generating the vector of indices

Eventually, the final tensor equation is

The function that maps equation to the right row and column equation of equation is


In this case, being equation a sample, the coefficient is implemented as

Example

from sklearn.datasets import fetch_covtype
from tab2img.converter import Tab2Img

dataset = fetch_covtype()

train = dataset.data
target = dataset.target

model = Tab2Img()
images = model.fit_transform(train, target)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tab2img-0.0.2.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

tab2img-0.0.2-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page