https://github.com/leffff/waveml
Open source machine learning library with various machine learning tools
https://github.com/leffff/waveml
categorical-encoding ensemble feature-transformation linear-transformations stacked-predictions stacking weighted-averages
Last synced: 26 days ago
JSON representation
Open source machine learning library with various machine learning tools
- Host: GitHub
- URL: https://github.com/leffff/waveml
- Owner: leffff
- License: apache-2.0
- Created: 2021-01-16T15:30:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-27T19:52:03.000Z (over 3 years ago)
- Last Synced: 2025-12-01T02:29:05.536Z (2 months ago)
- Topics: categorical-encoding, ensemble, feature-transformation, linear-transformations, stacked-predictions, stacking, weighted-averages
- Language: Python
- Homepage:
- Size: 70.3 KB
- Stars: 10
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pypi.org/project/waveml/)
[](https://github.com/leffff/waveml/blob/main/LICENSE)
[](https://pypi.python.org/pypi/waveml/)
# waveml
Open source machine learning library for performance of a weighted average and linear transformations over stacked predictions
### Pip
```
pip install waveml
```
## Overview
waveml features four models:
> [WaveStackingTransformer](https://github.com/leffff/waveml#WaveStackingTransformer)
> [WaveRegressor](https://github.com/leffff/waveml#WaveRegressor)
> [WaveTransformer](https://github.com/leffff/waveml#WaveTransformer)
> [WaveEncoder](https://github.com/leffff/waveml#WaveEncoder)
## WaveStackingTransformer
Performs Classical Stacking
Can be used for following objectives:
> Regression
> Classification
> Probability Prediction
### Usage example
```python
from waveml import WaveStackingTransformer
from catboost import CatBoostRegressor
from xgboost import XGBRegressor
from lightgbm import LGBMRegressor
wst = WaveStackingTransformer(
models=[
("CBR", CatBoostRegressor()),
("XGBR", XGBRegressor()),
("LGBMR", LGBMRegressor())
],
n_folds=5,
verbose=True,
regression=True,
random_state=42,
shuffle=True
)
from sklearn.datasets import load_boston
form sklearn.model_selection import train_test_split
X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, shuffle=True)
SX_train = wst.fit_transform(X_train, y_train, prettified=True)
SX_test = wst.transform(X_test, prettified=True)
from sklearn.linear_model import LinearRegression
lr = LinearRegression()
lr.fit(SX_train, y_train)
lr.predict(SX_test)
```
### Sklearn compatibility
```python
from sklearn.pipeline import Pipeline
pipeline = Pipeline(
steps=[
("Stack_L1", wst),
("Final Estimator", lr)
]
)
pipeline.fit(X_train, y_train)
pipeline.predict(X_test)
```
## WaveRegressor
Performs weighted average over stacked predictions
Analogue of Linear Regression without intercept
Linear Regression: *y = b0 + b1x1 + b2x2 + ... + bnxn*
Weihghted Average: *y = b1x1 + b2x2 + ... + bnxn*
### Usage example
```python
from waveml import WaveRegressor
wr = WaveRegressor()
wr.fit(SX_train, y_train)
wr.predict(SX_test)
```
### Sklearn compatebility
```python
from sklearn.pipeline import Pipeline
pipeline = Pipeline(
steps=[
("Stack_L1", wst),
("Final Estimator", WaveRegressor())
]
)
pipeline.fit(X_train, y_train)
pipeline.predict(X_test)
```
## WaveTransformer
Performs cross validated linear transformations over stacked predictions
### Usage example
```python
from waveml import WaveTransformer
wt = WaveTransformer()
wt.fit(X_train, y_train)
wt.transform(X_test)
```
### Sklearn compatebility
```python
pipeline = Pipeline(
steps=[
("Stack_L1", wst),
("LinearTransformations", WaveTransformer()),
("Final Estimator", WaveRegressor())
]
)
```
## WaveEncoder
Performs encoding of categorical features in the initial dataset
```python
from waveml import WaveEncoder
we = WaveEncoder(encodeing_type="label")
X_train = we.fit_transform(X_train)
X_test = we.transform(X_test)
```