TINTO
The TINTO method transforms tabular data into synthetic images by projecting it into a two-dimensional space and applying visualization techniques. It projects features onto a 2D grid (using PCA or t-SNE), finalizes pixel positions, and optionally applies a blurring effect to blend feature values into neighboring pixels.
Import TINTO
To import TINTO model use:
>>> from TINTOlib.tinto import TINTO
>>> model = TINTO()
Inherited base functionality
TINTO inherits from MappingMethod (see Base classes), so it also provides:
Feature coordinates: a feature-to-pixel mapping exported to
features_positions.csvafterfit/fit_transform.Programmatic access:
_get_features_mapping()returns the feature coordinates as a DataFrame once the model is fitted.Shared utilities:
saveHyperparameters/loadHyperparametersand the standardfit/transform/fit_transformworkflow.
Hyperparameters & Configuration
When creating the tinto class, some parameters can be modified. The parameters are:
Parameters |
Description |
Default value |
Valid values |
|---|---|---|---|
|
The type of problem, defining how the images are grouped. |
‘classification’ |
[‘classification’, ‘unsupervised’, ‘regression’] |
|
Preprocessing transformations like scaling, normalization, etc. |
MinMaxScaler() |
Scikit Learn transformers or custom implementation inheriting CustomTransformer. |
|
Show execution details in the terminal. |
False |
[True, False] |
|
The number of pixels used to create the image (one side). Total pixels = pixels * pixels. |
20 |
integer |
|
Select the dimensionality reduction algorithm. |
‘PCA’ |
[‘PCA’, ‘t-SNE’] |
|
Activate or deactivate the blurring option. |
False |
[True, False] |
|
Specifies whether to use a submatrix for blurring. |
True |
[True, False] |
|
Only used when blur=True. Specifies the blurring amplification. |
|
float |
|
Only used when blur=True. Specifies the blurring distance (number of pixels). |
2 |
integer |
|
Only used when blur=True. Specifies the number of blurring steps. |
4 |
integer |
|
Only used when blur=True. Technique for handling overlapping pixels. |
‘mean’ |
[‘mean’, ‘maximum’] |
|
Only used when algorithm=’t-SNE’. Specifies the replication times in t-SNE. |
4 |
integer |
|
Multiplication factor determining the size of the saved image relative to the original size. Values greater than 1 increase the image size proportionally. |
1 |
integer |
|
Output format using images with matplotlib with [0,255] range for pixel or using npy format. |
‘png’ |
[‘png’, ‘npy’] |
|
Color map to use with matplotlib. If images with unique channel is required this parameter must be None. Accepts standard Matplotlib colormaps. |
‘binary’ |
‘viridis’, ‘plasma’, ‘inferno’, ‘magma’, ‘cividis’, ‘Greys’, ‘Purples’, etc. or None |
|
Seed for reproducibility. |
1 |
integer |
Code example:
>>> model = TINTO(algorithm="t-SNE", pixels=30, blur=True, option="maximum", cmap="viridis")
All the parameters that aren’t specifically set will have their default values.
Functions
TINTO has the following functions:
Function |
Description |
Output |
|---|---|---|
|
Allows to save the defined parameters (scale, fea_dost_method, image_dist_method, etc.) |
.pkl file with the configuration |
|
Load TINTO configuration previously saved with
|
|
|
Trains the model on the tabular data and prepares it for image generation.
|
|
|
Generates and saves synthetic images in a specified folder. Requires the model to be fitted first.
|
Folders with synthetic images |
|
Combines the training and image generation steps. Fits the model to the data and generates synthetic images in one step.
|
Folders with synthetic images |
The model must be fitted before using the transform method. If the model isn’t fitted, a RuntimeError will be raised.
Citation
Paper: https://doi.org/10.1016/j.inffus.2022.10.011
Code Repository: https://github.com/oeg-upm/TINTO