Skip to main content

Quicksemble

Downloads

Quicksemble is a simple package to create a stacked ensemble for quick experiments. It is developed in T2P Co., Ltd.

Dependencies

  1. Numpy pip install numpy
  2. Scikit Learn pip install scikit-learn
  3. Xgboost pip install xgboost

Installation

pip install quicksemble

Basic Usage

from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from quicksemble.ensembler import Ensembler

#
# Define train and test dataset here
#

models = [
    RandomForestClassifier(random_state=21),
    XGBClassifier(random_state=21)
]
# Default meta classifier is LogisticRegression. Hence it is weighted voting.
ensemble = Ensembler(models)
ensemble.fit(X_train, y_train)
ensemble.predict(X_test)

To change the default meta classifer:

from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from quicksemble.ensembler import Ensembler

#
# Define train and test dataset here
#

models = [
    RandomForestClassifier(random_state=21),
    XGBClassifier(random_state=21)
]

# Use Neural Network as meta classifier
ensemble = Ensembler(models, meta_model=MLPClassifier())
ensemble.fit(X_train, y_train)
ensemble.predict(X_test)

By default, Base models use "hard" voting, i.e., it outputs predictions of the base models. We can switch it to "soft" voting, i.e., it outputs probabilities of each class by the base model.

To change voting style:

from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from quicksemble.ensembler import Ensembler

#
# Define train and test dataset here
#

models = [
    RandomForestClassifier(random_state=21),
    XGBClassifier(random_state=21)
]

# Use soft voting. 
ensemble = Ensembler(models, voting='soft')
ensemble.fit(X_train, y_train)
ensemble.predict(X_test)

To view output of intermediary state i.e., output of base layers (layer 1) that is going into meta layer (layer 2). Internally, it uses Pipelines from scikit-learn. So, feel free to read docs about pipelines.

ensemble = Ensembler(models, voting='soft')
ensemble.fit(X_train, y_train)

# This line will output the values. Note that you need to fit it first.
ensemble.ensemble.named_steps['base_layer'].transform(X_train)

For already saved models, use modelpaths. Note that it should be pickled.

es = Ensembler(modelpaths=[
            'rf.pkl',
            'xg.pkl'
    ])
es.fit(X_train, y_train)
es.predict(X_train)

Metadata

Release files for quicksemble 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quicksemble 0.2.8
File Size Uploaded Provenance Actions
quicksemble-0.2.8.tar.gz 4.4 kB Without provenance Details for quicksemble-0.2.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quicksemble 0.2.8
File Interpreter ABI Platform Actions
quicksemble-0.2.8-py3-none-any.whl Python 3 none any Details for quicksemble-0.2.8-py3-none-any.whl

Total release size: 9.6 kB

Release files / quicksemble-0.2.8.tar.gz

Download URL quicksemble-0.2.8.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
951ed8383370cf8ef031d7e1814ebb1ea2da7331952000d44c9e6d5b94d586ea
BLAKE2b-256 checksum
How to use checksums
6b6ce48bd6c563fe206058c35ddd86b4b2ce2b508ce99a37ba0099d01a627e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.27.0 CPython/3.6.5

Release files / quicksemble-0.2.8-py3-none-any.whl

Download URL quicksemble-0.2.8-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cbef814ce65aabf319ba1dcff949057d44fa9fe2c0f1689133318215214d3ff
BLAKE2b-256 checksum
How to use checksums
fc93b209bd48c4ff5e6ee705e8f4ce05131d48f0d1ab06d7038bc970389fdd4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.27.0 CPython/3.6.5

Security for quicksemble 0.2.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page