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 with samples and features, we are required to find a function , where .
There are numerous ways to choose . In this implementation, the features are organized with respect to the correlation vector , where is the target vector. Given and as
the vector express the Pearson correlation coefficient*
where
At this point is sorted from the greatest to the smallest, generating the vector of indices
Eventually, the final tensor is
The function that maps to the right row and column of is
In this case, being 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.