Skip to main content

Ferramenta para determinar a proporção ideal de dados sintéticos em modelos de ML

Project description

🎯 DataTunner

Automatic Optimization of Synthetic Data Proportions for Deep Learning Models

License: MIT Python 3.8+ PyPI version

🇧🇷 Versão em Português

📖 About

DataTunner is an open-source Python tool that automates the process of determining the optimal proportion of synthetic data to maximize neural network model performance.

The growing demand for large volumes of data for training Deep Learning models has driven the use of synthetic data as a solution to data scarcity and dataset imbalance. DataTunner systematizes this process, which traditionally is empirical and unstructured.

✨ Key Features

  • 🔄 Automatic Hybrid Dataset Generation: Combines real and synthetic data in different proportions
  • 🖼️ Image Support: CNNs (ResNet, VGG, MobileNet) with data augmentation
  • 📊 Tabular Data Support: MLPs, Random Forest, XGBoost with SMOTE and CTGAN
  • 📈 Comprehensive Metrics: Accuracy, Precision, Recall, F1-Score, ROC-AUC
  • 🎨 Rich Visualizations: Interactive charts and detailed reports
  • 🔬 Guaranteed Reproducibility: Fixed seeds and controlled hyperparameters
  • GPU Support: CUDA acceleration
  • 💾 Checkpointing: Resume interrupted experiments

🚀 Installation

Basic Installation

pip install datatunner

Development Installation

git clone https://github.com/leandrocrx/datatunner.git
cd datatunner
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e ".[dev]"

📚 Quick Start

Image Example (CIFAR-10)

from datatunner import DataTunner
from datatunner.models.cnn import ResNetClassifier
from datatunner.generators.augmentation import ImageAugmentation

# Configure optimizer
tunner = DataTunner(
    data_type='image',
    real_data_path='data/cifar10/real',
    synthetic_data_path='data/cifar10/synthetic',
    output_dir='results/cifar10'
)

# Define model
model = ResNetClassifier(num_classes=10, architecture='resnet18')

# Run optimization
results = tunner.optimize(
    model=model,
    proportions=[0.0, 0.1, 0.2, 0.3, 0.5, 0.7, 1.0],
    epochs=50,
    batch_size=64,
    n_trials=3  # Repetitions for robustness
)

# Visualize results
tunner.plot_results()
print(f"Best proportion: {results['best_proportion']}")

Tabular Data Example

from datatunner import DataTunner
from datatunner.models.mlp import MLPClassifier
from datatunner.generators.smote import SMOTEGenerator

# Configure optimizer
tunner = DataTunner(
    data_type='tabular',
    real_data_path='data/adult/train.csv',
    test_data_path='data/adult/test.csv',
    output_dir='results/adult'
)

# Generate synthetic data with SMOTE
generator = SMOTEGenerator(k_neighbors=5)
synthetic_data = generator.generate(data=tunner.real_data, n_samples=5000)

# Define model
model = MLPClassifier(hidden_layers=[128, 64, 32], dropout=0.3)

# Run optimization
results = tunner.optimize(
    model=model,
    synthetic_data=synthetic_data,
    proportions=[0.0, 0.1, 0.2, 0.3, 0.5, 0.7, 1.0],
    epochs=100,
    batch_size=128
)

# Detailed report
tunner.generate_report(format='html')

📊 Methodology

For Image Datasets

  1. Input: Real images + synthetic images (augmentation, GANs, diffusion)
  2. Mixing: Combination in varied proportions with class balancing
  3. Training: CNNs (ResNet, VGG, MobileNet) with fixed hyperparameters
  4. Evaluation: Metrics on independent test set

For Tabular Datasets

  1. Input: Real tabular data + synthetic (SMOTE, CTGAN)
  2. Mixing: Preservation of distributions and correlations
  3. Training: MLPs, Random Forest, XGBoost, LightGBM
  4. Evaluation: Specific metrics for imbalance

🏗️ Architecture

datatunner/
├── core/           # Optimization and evaluation engine
├── generators/     # Synthetic data generators
├── models/         # ML/DL models
├── utils/          # Utilities and visualization
└── config/         # Configuration

🧪 Testing

pytest tests/ -v --cov=datatunner

📖 Documentation

See complete examples in the examples/ folder and documentation in the repository's Markdown files.

🤝 Contributing

Contributions are welcome! Please read our contribution guide.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📚 Citation

If you use DataTunner in your research, please cite:

@software{datatunner2026,
  author = {Rocha, Leandro},
  title = {DataTunner: Synthetic Data Proportion Optimization},
  year = {2026},
  url = {https://github.com/leandrocrx/datatunner}
}

👥 Authors

🙏 Acknowledgments

Based on research about synthetic data optimization for Deep Learning models.


Developed with ❤️ for the Data Science community

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

datatunner-0.1.1.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datatunner-0.1.1-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file datatunner-0.1.1.tar.gz.

File metadata

  • Download URL: datatunner-0.1.1.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for datatunner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d587029e330f9fa023e1e5227a07cec61ae9ff3156bc58238c0c86c7a80711df
MD5 a04c1c7c65a4ab20a467356a8d42ce15
BLAKE2b-256 942b0a98485c5f4301bffc072fbba15ab08623dc698b47da5b0bca6e8e328049

See more details on using hashes here.

File details

Details for the file datatunner-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: datatunner-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for datatunner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87bd4834c47946c78f0cdf7da09e90dcc772f92f6a4faeb875d0d0f900ee5f9d
MD5 acce6d8ed3c4b80b5b624494aaa11415
BLAKE2b-256 8785e3c936a15031cd85a08c2944a1cfeb159abbd8c0bb248aaea9d7333e6e15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page