nicomignoni / tab2img

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

About

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

License:MIT License


Languages

Language:Python 100.0%