A python package for the Cyclic Gradient Boosting Machine algorithm
Project description
cyc-gbm
A package for the Cyclic Gradient Boosting Machine algorithm. For the (pre-print) paper describing the algorithm, see here.
Installation
You can install the package using pip:
pip install cyc-gbm
Alternatively, you can install the package from source. This will also include a pipeline for reproducing the results in the paper. Follow these steps:
- Clone this repository to your local machine:
git clone https://github.com/henningzakrisson/cyc-gbm.git
- Create a virtual environment in the root directory of the repository:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
Usage example
Fitting the mean and (log) sigma parameters of a normal distribution to a simulated dataset:
import numpy as np
from cyc_gbm import CyclicalGradientBooster
from sklearn.model_selection import train_test_split
# Simulate data
X = np.random.normal(size=(1000, 2))
mu = X[:, 0] + 10 * (X[:, 1] > 0)
sigma = np.exp(3 - 2 * (X[:, 0] > 0))
y = np.random.normal(mu, sigma)
# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Fit model
model = CyclicalGradientBooster(
distribution='normal',
learning_rate=0.1,
n_estimators=[26, 34],
min_samples_split = 2,
min_samples_leaf=20,
max_depth=2,
)
model.fit(X_train, y_train)
# Evaluate
loss = model.dist.loss(y=y_test, z=model.predict(X_test)).sum()
print(f'negative log likelihood: {loss}')
Contact
If you have any questions, feel free to contact me here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cyc-gbm-0.0.33.tar.gz
(17.0 kB
view details)
Built Distribution
cyc_gbm-0.0.33-py3-none-any.whl
(16.1 kB
view details)
File details
Details for the file cyc-gbm-0.0.33.tar.gz
.
File metadata
- Download URL: cyc-gbm-0.0.33.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad29c4cf0e2d0ad124181717e58aba71fc8ec7be9c1005edfc99857b996022b9 |
|
MD5 | 3f2d862d14453d63edb22070f0da511f |
|
BLAKE2b-256 | a616b250f57b5fb47379ac82211c942bd20412ee937123071ed645dd2d9fdea7 |
File details
Details for the file cyc_gbm-0.0.33-py3-none-any.whl
.
File metadata
- Download URL: cyc_gbm-0.0.33-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 792403a040a24191bee2cab3326f9c8a20e15f5f0baa2c5a63df1563162fee95 |
|
MD5 | 217adb29eca4d871d3dfb940225037e8 |
|
BLAKE2b-256 | 95724beed63e8c1e80813511c82d55dbdc34c90756bddd6009fb2e2efba7973d |