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)
Metadata
Release files for tab2img 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tab2img-0.0.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tab2img-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / tab2img-0.0.2.tar.gz
| Download URL | tab2img-0.0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
606815115472422c3992d36e3d7a0b4793cc906d6b132c7f599f9d233ffb975b
|
|
BLAKE2b-256 checksum How to use checksums |
893f8150f700470d490754cca8dab05f7962b2bb79eb40b94b192ceb76d4b455
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / tab2img-0.0.2-py3-none-any.whl
| Download URL | tab2img-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
916d3ea54fe0d3e088970dd86d306d6b49f5ae5e9b14e78d3f3f09e075de99a5
|
|
BLAKE2b-256 checksum How to use checksums |
3b17d0dec94d9c064842cfc0139a3c55821d8505ac59e1575c6dec9a890e85c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|