Kaggle Toolbox
Koolbox is a collection of helper functions and utilities designed to simplify training machine learning models in Kaggle competitions. This library abstracts away repetitive boilerplate code, allowing competitors to focus on more important tasks.
Installation
pip install koolbox
Usage
Trainer
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score
from koolbox import Trainer
X = pd.DataFrame(...)
y = pd.Series(...)
trainer = Trainer(
estimator=RandomForestClassifier(random_state=42),
cv=KFold(n_splits=5, shuffle=True, random_state=42),
metric=roc_auc_score,
task="binary",
verbose=True
)
trainer.fit(X, y)
X_test = pd.DataFrame(...)
preds = trainer.predict(X_test)
oof_preds = trainer.oof_preds
overall_score = trainer.overall_score
fold_scores = trainer.fold_scores
SequentialFeatureSelector
from sklearn.linear_model import Ridge
from sklearn.model_selection import KFold
from sklearn.metrics import root_mean_squared_error
import pandas as pd
from koolbox import SequentialFeatureSelector
X = pd.DataFrame(...)
y = pd.Series(...)
X_test = pd.DataFrame(...)
sfs = SequentialFeatureSelector(
Ridge(),
cv=KFold(n_splits=5, random_state=42, shuffle=True),
objective="minimize",
direction="backward",
metric=root_mean_squared_error
)
X = sfs.fit_transform(X, y)
X_test = sfs.transform(X_test)
selected_features = sfs.selected_features
WeightedEnsemble[Regressor, Classifier]
from sklearn.metrics import root_mean_squared_error
import pandas as pd
from koolbox import WeightedEnsembleRegressor
X = pd.DataFrame(...)
y = pd.Series(...)
X_test = pd.DataFrame(...)
model = WeightedEnsembleRegressor(
objective="minimize",
metric=root_mean_squared_error
)
model.fit(X, y)
preds = model.predict(X_test)
Metadata
Release files for koolbox 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| koolbox-0.1.3.tar.gz | 15.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| koolbox-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / koolbox-0.1.3.tar.gz
| Download URL | koolbox-0.1.3.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
562188495fa395800bcea7ca849aec9a16aad482f3673027067aa9ccf225aeea
|
|
BLAKE2b-256 checksum How to use checksums |
6e952b1f1787cda2ea4e1cab81f05543d4b14a693eb77ce25daa9ed8a16cb666
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2025.
Transparency logRelease files / koolbox-0.1.3-py3-none-any.whl
| Download URL | koolbox-0.1.3-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f654008252fe17463f27548b6a327926aa5451fdba52fe60fbb7639f5afc4bdc
|
|
BLAKE2b-256 checksum How to use checksums |
00201f14f43ae9f2945425cf388e72950f0ac2c1305152aacd9307e5f5bb3776
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2025.
Transparency log