DeepStack: Ensembles for Deep Learning
Project description
DeepStack
DeepStack: Ensembles for Deep Learning
DeepStack is a Python module for building Deep Learning Ensembles originally built on top of Keras and distributed under the MIT license.
Installation
pip install deepstack
Stacking
Stacking is based on training a Meta-Learner on top of pre-trained Base-Learners. DeepStack offers an interface to fit the Meta-Learner on the predictions of the Base-Learners. In the following an Example based on top of pre-trained Keras Models (there is also an interface for generic models):
Usage
from deepstack.base import KerasMember # For a generic (i.e., Non-Keras Model) check the class `Member`
from deepstack.ensemble import StackEnsemble
model1 = ... # A Keras pre-trained Model (Base-Learner)
train_batches1 = ... # A numpy tuple (X_train, y_train) or Keras Data Iterator - Training Data for Meta-Learner
val_batches1 = ... # A numpy tuple (X_val, y_val) or Keras Data Iterator - Validation Data for Meta-Learner
member1 = KerasMember(name="Model1", keras_model=model1, train_batches=train_batches1, val_batches=val_batches1)
model2 = ...
train_batches2 = ...
val_batches2 = ...
member2 = KerasMember(name="Model2", keras_model=model2, train_batches=train_batches2, val_batches=val_batches2)
stack = StackEnsemble()
stack.add_member(member1) # Assumption: the data iterators of base-learners iterate over the same data and have same shape and classes.
stack.add_member(member2)
stack.fit() # Fits meta-learner based on training batches from its members (base-learners)
stack.describe() # Prints information about ensemble performance based on validation data
Check an example on the CIFAR-10 dataset: Cifar10.py.
Randomized Weighted Ensemble
Ensemble Technique that weights the prediction of each ensemble member, combining the weights to calculate a combined prediction. Weight optimization search is performed with randomized search based on the dirichlet distribution on a validation dataset.
It follows the same interface of the StackEnsemble. An example can be found in Cifar10.py.
Citing DeepStack
If you use DeepStack in a scientific publication, we would appreciate citations:
@misc{
title = {DeepStack: Ensembles for Deep Learning},
author = {Julio Borges},
url = {https://github.com/jcborges/DeepStack},
date = {2019}
}
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
Built Distribution
File details
Details for the file deepstack-0.0.9.tar.gz
.
File metadata
- Download URL: deepstack-0.0.9.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e5012dec6914d8009e0c5759772614ff78fb036e62b2617a89706b81704e393 |
|
MD5 | 6fb97c4e66be5ae21029242c65a189a7 |
|
BLAKE2b-256 | 03eeafa7a702f50407bcebea660718bfba7544965bf853174abc9ba1e04262d3 |
File details
Details for the file deepstack-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: deepstack-0.0.9-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11f7ee09084a5f9d5cef85db9240dca75d50859a2da4556fed5846878c4bade |
|
MD5 | 14d6801a43b8363c05b29c9395ce9ddc |
|
BLAKE2b-256 | 360a7555b16579570cad2ec2b02b7a52ae6406f983e8fdde156ac3fe109fd16f |