You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Minimalistic. Get your stacked features in a single line
13
13
* RAM-friendly. The lowest possible memory consumption
14
-
* Kaggle-ready. Stacked features and hyperparameters from each run can be [automatically saved](https://github.com/vecxoz/vecstack/blob/master/vecstack/core.py#L209) in files. No more mess at the end of the competition. [Log example](https://github.com/vecxoz/vecstack/blob/master/examples/03_log_example.txt)
14
+
* Kaggle-ready. Stacked features and hyperparameters from each run can be [automatically saved](https://github.com/vecxoz/vecstack/blob/master/vecstack/core.py#L210) in files. No more mess at the end of the competition. [Log example](https://github.com/vecxoz/vecstack/blob/master/examples/03_log_example.txt)
* Standardized. Fully scikit-learn compatible transformer class exposing `fit` and `transform` methods
17
17
* Pipeline-certified. Implement and deploy [multilevel stacking](https://github.com/vecxoz/vecstack/blob/master/examples/04_sklearn_api_regression_pipeline.ipynb) like it's no big deal using `sklearn.pipeline.Pipeline`
18
18
* And of course `FeatureUnion` is also invited to the party
19
19
* Overall specs:
20
20
* Use any sklearn-like estimators
21
-
* Perform [classification and regression](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L83) tasks
22
-
* Predict [class labels or probabilities](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L119) in classification task
23
-
* Apply any [user-defined metric](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L124)
24
-
* Apply any [user-defined transformations](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L87) for target and prediction
25
-
* Python 3.5 and higher, [unofficial support for Python 2.7 and 3.4](https://github.com/vecxoz/vecstack/blob/master/PY2.md)
21
+
* Perform [classification and regression](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L85) tasks
22
+
* Predict [class labels or probabilities](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L121) in classification task
23
+
* Apply any [user-defined metric](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L126)
24
+
* Apply any [user-defined transformations](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L89) for target and prediction
25
+
* Python 3.9+, [unofficial support for Python 2.7 and 3.4](https://github.com/vecxoz/vecstack/blob/master/PY2.md)
* Depends on **numpy**, **scipy**, **scikit-learn>=0.18**
@@ -44,19 +44,19 @@ Convenient way to automate OOF computation, prediction and bagging using any num
44
44
*[Regression + Multilevel stacking using Pipeline](https://github.com/vecxoz/vecstack/blob/master/examples/04_sklearn_api_regression_pipeline.ipynb)
45
45
* Documentation:
46
46
*[Functional API](https://github.com/vecxoz/vecstack/blob/master/vecstack/core.py#L133) or type ```>>> help(stacking)```
47
-
*[Scikit-learn API](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L64) or type ```>>> help(StackingTransformer)```
47
+
*[Scikit-learn API](https://github.com/vecxoz/vecstack/blob/master/vecstack/coresk.py#L66) or type ```>>> help(StackingTransformer)```
48
48
49
49
# Installation
50
50
51
-
***Note:*** Python 3.5 or higher is required. If you’re still using Python 2.7 or 3.4 see [installation details here](https://github.com/vecxoz/vecstack/blob/master/PY2.md)
51
+
***Note:*** Python 3.9+ is officially supported and tested. If you’re still using Python 2.7 or 3.4 see [installation details here](https://github.com/vecxoz/vecstack/blob/master/PY2.md)
52
52
53
53
****Classic 1st time installation (recommended):***
54
54
*`pip install vecstack`
55
55
* Install for current user only (if you have some troubles with write permission):
56
56
*`pip install --user vecstack`
57
57
* If your PATH doesn't work:
58
58
*`/usr/bin/python -m pip install vecstack`
59
-
*`C:/Python36/python -m pip install vecstack`
59
+
*`C:/Python3/python -m pip install vecstack`
60
60
* Upgrade vecstack and all dependencies:
61
61
*`pip install --upgrade vecstack`
62
62
* Upgrade vecstack WITHOUT upgrading dependencies:
28.[Can I use `(Randomized)GridSearchCV` to tune the whole stacking Pipeline?](https://github.com/vecxoz/vecstack#28-can-i-use-randomizedgridsearchcv-to-tune-the-whole-stacking-pipeline)
138
138
29.[How to define custom metric, especially AUC?](https://github.com/vecxoz/vecstack#29-how-to-define-custom-metric-especially-auc)
139
139
30.[Do folds (splits) have to be the same across estimators and stacking levels? How does `random_state` work?](https://github.com/vecxoz/vecstack#30-do-folds-splits-have-to-be-the-same-across-estimators-and-stacking-levels-how-does-random_state-work)
140
+
31.[How does `vecstack.StackingTransformer` differ from `sklearn.ensemble.StackingClassifier`?](https://github.com/vecxoz/vecstack#31-how-does-vecstackstackingtransformer-differ-from-sklearnensemblestackingclassifier)
140
141
141
142
### 1. How can I report an issue? How can I ask a question about stacking or vecstack package?
142
143
@@ -167,7 +168,7 @@ Main idea is to use predictions as features.
167
168
More specifically we predict train set (in CV-like fashion) and test set using some 1st level model(s), and then use these predictions as features for 2nd level model. You can find more details (concept, pictures, code) in [stacking tutorial](https://github.com/vecxoz/vecstack/blob/master/examples/00_stacking_concept_pictures_code.ipynb).
168
169
Also make sure to check out:
169
170
*[Ensemble Learning](https://en.wikipedia.org/wiki/Ensemble_learning) ([Stacking](https://en.wikipedia.org/wiki/Ensemble_learning#Stacking)) in Wikipedia
* Classical [Kaggle Ensembling Guide](https://mlwave.com/kaggle-ensembling-guide/) or try [another link](https://web.archive.org/web/20210727094233/https://mlwave.com/kaggle-ensembling-guide/)
171
172
*[Stacked Generalization](https://www.researchgate.net/publication/222467943_Stacked_Generalization) paper by David H. Wolpert
172
173
173
174
### 5. What about stacking name?
@@ -216,7 +217,7 @@ Speaking about inner stacking mechanics, you should remember that when you have
216
217
### 12. What is *blending*? How is it related to stacking?
217
218
218
219
Basically it is the same thing. Both approaches use predictions as features.
219
-
Often this terms are used interchangeably.
220
+
Often these terms are used interchangeably.
220
221
The difference is how we generate features (predictions) for the next level:
221
222
**stacking*: perform cross-validation procedure and predict each part of train set (OOF)
222
223
**blending*: predict fixed holdout set
@@ -387,10 +388,14 @@ def auc(y_true, y_pred):
387
388
388
389
To ensure better result, folds (splits) have to be the same across all estimators and all stacking levels. It means that `random_state` has to be the same in every call to `stacking` function or `StackingTransformer`. This is default behavior of `stacking` function and `StackingTransformer` (by default `random_state=0`). If you want to try different folds (splits) try to set different `random_state` values.
389
390
391
+
### 31. How does `vecstack.StackingTransformer` differ from `sklearn.ensemble.StackingClassifier`?
392
+
393
+
It significantly differs. Please see a [detailed explanation](https://github.com/vecxoz/vecstack/issues/37).
394
+
390
395
391
396
# Stacking concept
392
397
393
-
1. We want to predict train set and test set with some 1st level model(s), and then use these predictions as features for 2nd level model(s).
398
+
1. We want to predict train set and test set with some 1st level model(s), and then use these predictions as features for 2nd level model(s).
394
399
2. Any model can be used as 1st level model or 2nd level model.
395
400
3. To avoid overfitting (for train set) we use cross-validation technique and in each fold we predict out-of-fold (OOF) part of train set.
396
401
4. The common practice is to use from 3 to 10 folds.
@@ -404,6 +409,7 @@ To ensure better result, folds (splits) have to be the same across all estimator
404
409
8. We can repeat this cycle using other 1st level models to get more features for 2nd level model.
405
410
9. You can also look at animation of [Variant A](https://github.com/vecxoz/vecstack#variant-a-animation) and [Variant B](https://github.com/vecxoz/vecstack#variant-b-animation).
406
411
412
+
407
413
# Variant A
408
414
409
415

@@ -429,3 +435,10 @@ To ensure better result, folds (splits) have to be the same across all estimator
429
435
# Variant B. Animation
430
436
431
437

438
+
439
+
440
+
# References
441
+
442
+
*[Ensemble Learning](https://en.wikipedia.org/wiki/Ensemble_learning) ([Stacking](https://en.wikipedia.org/wiki/Ensemble_learning#Stacking)) in Wikipedia
443
+
* Classical [Kaggle Ensembling Guide](https://mlwave.com/kaggle-ensembling-guide/) or try [another link](https://web.archive.org/web/20210727094233/https://mlwave.com/kaggle-ensembling-guide/)
444
+
*[Stacked Generalization](https://www.researchgate.net/publication/222467943_Stacked_Generalization) paper by David H. Wolpert
0 commit comments