Socket
Book a DemoInstallSign in
Socket

cyc-gbm

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cyc-gbm

A python package for the Cyclic Gradient Boosting Machine algorithm

0.0.33
pipPyPI
Maintainers
1

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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.