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.4.tar.gz (75.2 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.4-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datatunner-0.1.4.tar.gz
  • Upload date:
  • Size: 75.2 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.4.tar.gz
Algorithm Hash digest
SHA256 9a7afa010a505afa943a7f27d92471c2e2cc0bd57476a4592465d206eef7d84f
MD5 6e627727f9ea48392a207ea787dd7abd
BLAKE2b-256 2f23d75288f59567e60c0a5ca11f0b0fc5e50ff0fcc727d5e6ddbdce8bccfc4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datatunner-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 45.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c1f909cc6c85c729f45faffafc07620f96bf36b3a275c9c23d3930f5daa941b9
MD5 d7580be2d01ffe8002772c3f95e9ac63
BLAKE2b-256 4d203484fdac933b023643a2f7a46e2edf558a45e1ec9139150b66b4ed7e4ba5

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