Skip to main content

Support Tools for Machine Learning VIVIDLY

Project description

Vivid

Support Tools for Machine Learning Vividly 🚀

Usage

from sklearn.datasets import load_boston
import pandas as pd
from vivid.out_of_fold.boosting import LGBMRegressorOutOfFold
X, y = load_boston(return_X_y=True)
df = pd.DataFrame(X)
model = LGBMRegressorOutOfFold(name='lgbm', cv=6, root_dir='./')

easy to make more and more complex stacking model

copy_feat = CopyFeature(name='copy', root_dir='./boston_stacking')
process_feat = BostonProcessFeature(name='boston_base', root_dir='./boston_stacking')
concat_faet = [copy_feat, process_feat]

singles = [
    XGBoostRegressorOutOfFold(name='xgb_simple', parent=concat_faet),
    RFRegressorFeatureOutOfFold(name='rf', parent=concat_faet),
    KNeighborRegressorOutOfFold(name='kneighbor', parent=concat_faet),
    OptunaXGBRegressionOutOfFold(name='xgb_optuna', n_trials=20, parent=concat_faet),
    # seed averaging block
    create_boosting_seed_blocks(feature_class=XGBoostRegressorOutOfFold, prefix='xgb_', parent=concat_faet),
    create_boosting_seed_blocks(feature_class=LGBMRegressorOutOfFold, prefix='lgbm_', parent=concat_faet),

    # only processed feature
    create_boosting_seed_blocks(feature_class=LGBMRegressorOutOfFold, prefix='only_process_lgbm_',
                                parent=process_feat)
]
ens = EnsembleFeature(name='ensumble', parent=singles)  # ensemble of stackings

# create stacking models
stackings = [
    # ridge model has single models as input
    RidgeOutOfFold(name='stacking_ridge', parent=singles, n_trials=10),
    # xgboost parameter tuned by optuna
    OptunaXGBRegressionOutOfFold(name='stacking_xgb', parent=singles, n_trials=100),
]
stacking_stacking_knn \
    = KNeighborRegressorOutOfFold(name='stacking_stacking_knn', parent=stackings)
naive_xgb = XGBoostRegressorOutOfFold(name='naive_xgb', parent=copy_feat)

ens_all = RidgeOutOfFold(name='all_ridge', parent=[*singles, *stackings, ens, stacking_stacking_knn, naive_xgb])

ens_all.fit(train_df, y)

Install

pip install git+https://gitlab.com/nyker510/vivid

Sample Code

In /vivid/smaples, Some sample script codes exist.

Developer

Requirements

  • docker
  • docker-compose

create docker-image from docker-compose file

docker-compose build
docker-compose up -d
docker exec -it vivid-test bash

Test

use pytest for test tool (see gitlab-ci.yml).

pytest tests

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

python-vivid-0.3.1.1.tar.gz (129.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_vivid-0.3.1.1-py3-none-any.whl (61.2 kB view details)

Uploaded Python 3

File details

Details for the file python-vivid-0.3.1.1.tar.gz.

File metadata

  • Download URL: python-vivid-0.3.1.1.tar.gz
  • Upload date:
  • Size: 129.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for python-vivid-0.3.1.1.tar.gz
Algorithm Hash digest
SHA256 a4188e601da37d92a7f45611910ddc367851be32739926c63b8b6eaeb09f8cd3
MD5 245aa376d228d91e7d4f4ff5a11c4d09
BLAKE2b-256 148336059a799aa827b384faf7ba1f92054ac5d324b614db2f01655ddd921a8b

See more details on using hashes here.

File details

Details for the file python_vivid-0.3.1.1-py3-none-any.whl.

File metadata

  • Download URL: python_vivid-0.3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 61.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for python_vivid-0.3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1599179c186e3a4ca59914262c994448b84e4570fd91bc15f4a5c934fd4a1848
MD5 486e555d197404c0cf18fdb9d3ed9a07
BLAKE2b-256 99d3b5018419ad1a5b9efcacde13e7a1605b9b5fd7e9dd072e1d26ea0f9d82ac

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