Skip to content

Instantly share code, notes, and snippets.

@caioaao
caioaao / stack.py
Last active June 10, 2018 15:54
Simple sklearn-compatible class to stack models
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import cross_val_predict
from sklearn.pipeline import make_union
from sklearn.model_selection._split import check_cv
from sklearn.utils.validation import check_X_y
class BlendedClassifierTransformer(BaseEstimator, TransformerMixin):
def __init__(self, clf, cv=3):
self.clf = clf
self.cv = cv