kiraplenkin / lastochka

Weight of Evidence transformation algorithm in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lastochka

Build Status codecov PyPI version

Weight of Evidence transformation, implemented in Python.

Quickstart

  1. Install the package:
pip install lastochka
  1. Use module as scikit-learn transformer:
import pandas as pd
from lastochka import LastochkaTransformer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split

X, y = make_classification(n_samples=10000, n_features=10, n_informative=2, random_state=42)

X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, test_size=0.3, random_state=42)

column_names = ['X%i' % i for i in range(10)]

D_train = pd.DataFrame(X_train, columns=column_names)
D_test = pd.DataFrame(X_test, columns=column_names)

lastochka = LastochkaTransformer()
log = LogisticRegression()

pipe = Pipeline(steps=[
        ('lastochka', lastochka),
        ('log', log)])

pipe.fit(D_train, y_train)

test_proba = pipe.predict_proba(D_test)

About

Weight of Evidence transformation algorithm in Python

License:MIT License


Languages

Language:Python 99.7%Language:Makefile 0.3%