

Ensemble pytorch
Un cadre d'ensemble unifié pour Pytorch afin d'améliorer facilement les performances et la robustesse de votre modèle d'apprentissage en profondeur. Ensemble-Pytorch fait partie de l'écosystème du pytorch, qui nécessite que le projet soit bien entretenu.
Installation
pip install torchensemble
Exemple
from torchensemble import VotingClassifier # voting is a classic ensemble strategy
# Load data
train_loader = DataLoader (...)
test_loader = DataLoader (...)
# Define the ensemble
ensemble = VotingClassifier (
estimator = base_estimator , # estimator is your pytorch model
n_estimators = 10 , # number of base estimators
)
# Set the optimizer
ensemble . set_optimizer (
"Adam" , # type of parameter optimizer
lr = learning_rate , # learning rate of parameter optimizer
weight_decay = weight_decay , # weight decay of parameter optimizer
)
# Set the learning rate scheduler
ensemble . set_scheduler (
"CosineAnnealingLR" , # type of learning rate scheduler
T_max = epochs , # additional arguments on the scheduler
)
# Train the ensemble
ensemble . fit (
train_loader ,
epochs = epochs , # number of training epochs
)
# Evaluate the ensemble
acc = ensemble . evaluate ( test_loader ) # testing accuracy Ensemble pris en charge
| Nom d'ensemble | Taper | Code source | Problème |
|---|
| Fusion | Mixte | fusion.py | Classification / régression |
| Vote [1] | Parallèle | vote.py | Classification / régression |
| Forêt neurale | Parallèle | vote.py | Classification / régression |
| Enbotant [2] | Parallèle | embarquant.py | Classification / régression |
| Boosting du gradient [3] | Séquentiel | gradient_boosting.py | Classification / régression |
| Ensemble instantané [4] | Séquentiel | snapshot_ensemble.py | Classification / régression |
| Formation contradictoire [5] | Parallèle | adversarial_training.py | Classification / régression |
| Ensemble géométrique rapide [6] | Séquentiel | fast_geometric.py | Classification / régression |
| Soft Gradient Boosting [7] | Parallèle | soft_gradient_boosting.py | Classification / régression |
Dépendances
- Scikit-learn> = 0,23,0
- torch> = 1.4.0
- torchVision> = 0.2.2
Référence
| [1] | Zhou, Zhi-hua. Méthodes d'ensemble: fondations et algorithmes. CRC Press, 2012. |
| [2] | Breiman, Leo. Prédicteurs d'ensachage. Machine Learning (1996): 123-140. |
| [3] | Friedman, Jerome H. Fonction gourmand approximation: une machine à augmenter le gradient. Annals of Statistics (2001): 1189-1232. |
| [4] | Huang, Gao, et al. Ensembles instantanés: Train 1, obtenez M gratuitement. ICLR, 2017. |
| [5] | Lakshminarayanan, Balaji, et al. Estimation de l'incertitude prédictive simple et évolutive à l'aide d'ensembles profonds. Nips, 2017. |
| [6] | Garipov, Timur, et al. Surfaces de perte, connectivité en mode et ensemble rapide des DNN. Neirips, 2018. |
| [7] | Feng, Ji, et al. Soft Gradient Boosting Machine. Arxiv, 2020. |
Merci à tous nos contributeurs