Skip to main content

Converting tabular data into images

Project description

TINTOlib

License Python Version Documentation Status Open In Colab-CNN Open In Colab-CNN+MLP Open In Colab-CNN+MLP-reg

TINTO Logo

TINTOlib is a state-of-the-art library that wraps the most important techniques for the construction of Synthetic Images fromTidy Data (also known as Tabular Data).

Citing TINTO: If you used TINTO in your work, please cite the SoftwareX:

@article{softwarex_TINTO,
    title = {TINTO: Converting Tidy Data into Image for Classification with 2-Dimensional Convolutional Neural Networks},
    journal = {SoftwareX},
    author = {Manuel Castillo-Cara and Reewos Talla-Chumpitaz and Raúl García-Castro and Luis Orozco-Barbosa},
    volume={22},
    pages={101391},
    year = {2023},
    issn = {2352-7110},
    doi = {https://doi.org/10.1016/j.softx.2023.101391}
}

And use-case developed in INFFUS Paper

@article{inffus_TINTO,
    title = {A novel deep learning approach using blurring image techniques for Bluetooth-based indoor localisation},
    journal = {Information Fusion},
    author = {Reewos Talla-Chumpitaz and Manuel Castillo-Cara and Luis Orozco-Barbosa and Raúl García-Castro},
    volume = {91},
    pages = {173-186},
    year = {2023},
    issn = {1566-2535},
    doi = {https://doi.org/10.1016/j.inffus.2022.10.011}
}

Features

  • Input data formats (2 options):

    • Pandas Dataframe
    • Files with the following format
      • Tabular files: The input data must be in CSV, taking into account the Tidy Data format.
      • Tidy Data: The target (variable to be predicted) should be set as the last column of the dataset. Therefore, the first columns will be the features.
      • All data must be in numerical form.
  • Runs on Linux, Windows and macOS systems.

  • Compatible with Python 3.7 or higher.

Models

Model Class Features Hyperparameters
BarGraph BarGraph() problem verbose pixel_width gap zoom
BIE BIE() problem verbose precision zoom
Combination Combination() problem verbose zoom
DistanceMatrix DistanceMatrix() problem verbose zoom
FeatureWrap FeatureWrap() problem verbose size bins zoom
IGTD IGTD() problem verbose scale fea_dist_method image_dist_method max_step val_step error switch_t min_gain random_seed zoom
REFINED REFINED() problem verbose hcIterations random_seed zoom n_processors
SuperTML SuperTML() problem columns font_size image_size verbose
TINTO TINTO() blur problem algorithm pixels blur amplification distance steps option seed times verbose

Documentation

Read the documentation.

Getting Started

You can install TINTOlib using Pypi:

    pip install torchmetrics pytorch_lightning TINTOlib imblearn keras_preprocessing mpi4py

To import a specific model use

    from TINTOlib.tinto import TINTO

Create the model. If you don't set any hyperparameter, the model will use the default values (read documentation).

    model = TINTO(blur=True)

To generate the synthetic images use .generateImages(data,folder) method.

    model.generateImages(data, resultsFolderPath)

How to use TINTOlib - Google Colab crash course

Once the images have been created by TINTO, they can be imported into any project using CNNs.

In order to facilitate their use, a Jupyter Notebook has been created in which you can see how the images are read and how they can be used as input in a CNN.

Converting Tidy Data into image

For example, the following table shows a classic example of theIRIS CSV dataset as it should look like for the run:

sepal length sepal width petal length petal width target
4.9 3.0 1.4 0.2 1
7.0 3.2 4.7 1.4 2
6.3 3.3 6.0 2.5 3

Simple example without Blurring

The following example shows how to create 20x20 images with characteristic pixels, i.e. without blurring. Also, as no other parameters are indicated, you will choose the following parameters which are set by default:

  • Image size: 20x20 pixels
  • Blurring: No blurring will be used.
  • Seed: with the seed set to 20.

TINTO characteristic pixel

More specific example

The following example shows how to create with blurring with a more especific parameters.

The images are created with the following considerations regarding the parameters used:

  • Blurring (-B): Create the images with blurring technique.
  • Dimensional Reduction Algorithm (-alg): t-SNE is used.
  • Blurring option (-oB): Create de images with maximum value of overlaping pixel
  • Image size (-px): 30x30 pixels
  • Blurring steps (-sB): Expand 5 pixels the blurring.

TINTO blurring

License

TINTOlib is available under the Apache License 2.0.

Authors

Contributors

Ontology Engineering Group Universidad Politécnica de Madrid Universidad Nacional de Educación a Distancia Universidad de Castilla-La Mancha

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

tintolib-0.0.26.tar.gz (29.2 MB view details)

Uploaded Source

Built Distribution

tintolib-0.0.26-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file tintolib-0.0.26.tar.gz.

File metadata

  • Download URL: tintolib-0.0.26.tar.gz
  • Upload date:
  • Size: 29.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.13

File hashes

Hashes for tintolib-0.0.26.tar.gz
Algorithm Hash digest
SHA256 5946aada0746f476541782ca3e05facc17da1864f5fb3eed50f64c6fdc77fb50
MD5 da087d56628629da92fd4f4e77e08997
BLAKE2b-256 4c443fb54bc775a07d697d669272c8ec5f2943f9252c69e597aaba15e4e287c2

See more details on using hashes here.

File details

Details for the file tintolib-0.0.26-py3-none-any.whl.

File metadata

  • Download URL: tintolib-0.0.26-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.13

File hashes

Hashes for tintolib-0.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 3c106464184bacd06416fd19d5bb896002f2e85e8fd08ee3bc939df08be513e2
MD5 f5d350896d7ee9b3201083aab6fcc58a
BLAKE2b-256 d90482849b20487e5bea2d4959dc3460d417833e0c882f08f88fdcfbb5cf9232

See more details on using hashes here.

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