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.2.tar.gz (66.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.2-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datatunner-0.1.2.tar.gz
  • Upload date:
  • Size: 66.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.2.tar.gz
Algorithm Hash digest
SHA256 ff753b325d5ddacb2834bd755baab611935033eaa323790fc647879b906891c8
MD5 5469e5ecf4a4f1612a8503cfe7238792
BLAKE2b-256 94363c27a2a6a03059004fa6c7564d80b7ff574ae2b959312ffc533923ad5b45

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datatunner-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 45.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ebcb582ca3aef816ca45ed8a6ad0a12b188451c7c486823f27472fe9e2f70f6
MD5 8161c15d299c56d2808c499ea30cbd17
BLAKE2b-256 3c15c51fbceecef60380dd7957c54e894dbab3a540e415eb8545833af8988bf5

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