Software: TINTOlib - Python library for transforming tabular data into images with 2-Dimensional Convolutional Neural Networks

TINTO Logo

Description

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

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.

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}
}

Methods

MethodsClassFeaturesHyperparameters
TINTOTINTO()blurproblem algorithm pixels submatrix blur amplification distance steps option random_seed times verbose
IGTDIGTD() problem scale fea_dist_method image_dist_method max_step val_step error switch_t min_gain zoom random_seed verbose
REFINEDREFINED() problem n_processors hcIterations zoom random_seed verbose
BarGraphBarGraph() problem pixel_width gap zoom verbose
DistanceMatrixDistanceMatrix() problem zoom verbose
CombinationCombination() problem zoom verbose
SuperTMLSuperTML() problem columns font_size image_size verbose
FeatureWrapFeatureWrap() problem size bins zoom verbose
BIEBIE() problem precision zoom verbose

TINTOlib Crash Course:

TINTOlib Crash Course repository provides a comprehensive crash course on using TINTOlib, a Python library designed to transform tabular data into synthetic images for machine learning tasks. It includes slides and Jupyter notebooks that demonstrate how to apply state-of-the-art vision models like Vision Transformers (ViTs) and Convolutional Neural Networks (CNNs) to problems such as regression and classification, using TINTOlib for data transformation.

The repository also features Hybrid Neural Networks (HyNNs), where one branch is an MLP designed to process tabular data, while another branch—either CNN or ViT—handles the synthetic images. This architecture leverages the strengths of both data formats for enhanced performance on complex machine learning tasks. Ideal for those looking to integrate image-based deep learning techniques into tabular data problems.

ACCESS HERE

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, ViT and HyNN. Note that you access in more examples in TINTOlib Crash Course.

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, ViT and HyNN.

  • TensorFlow - CNN:
    Open In Colab - TensorFlow CNN

  • TensorFlow - CNN + MLP Hybrid:
    Open In Colab - TensorFlow CNN + MLP

  • TensorFlow - Vision Transformer (ViT):
    Open In Colab - TensorFlow ViT

  • TensorFlow - ViT + MLP Hybrid:
    Open In Colab - TensorFlow ViT + MLP

Converting Tidy Data into synthetic image

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

sepal lengthsepal widthpetal lengthpetal widthtarget
4.93.01.40.21
7.03.24.71.42
6.33.36.02.53

Simple example with TINTO method

The following example shows how to create 20x20 images with characteristic pixels with TINTO method:

More information

License

TINTOlib is available under the Apache License 2.0.

Authors