Skip to main content

Thompson Sampling using bootstrap sampling

Project description

Galileo Forecast

Galileo Forecast is a Python package that implements Thompson Sampling. It provides a flexible wrapper that can be used with various base model classes.

Installation

You can install Galileo Forecast using pip:

pip install galileo-forecast

Usage

To use Galileo Forecast, you need to create a wrapper for your base model class. Here's an example with LightGBM:

from galileo_forecast import ThompsonSamplingWrapper
from lightgbm import LGBMClassifier

# make classification data, us sklearn make_classification
from sklearn.datasets import make_classification

# sample data with low hit rate
X, y = make_classification(n_samples=1000, n_features=10, n_informative=1, n_redundant=1, n_clusters_per_class=1, class_sep=0.1)

# create a wrapper for the LightGBM model  
wrapper = ThompsonSamplingWrapper(base_model_class=LGBMClassifier, num_models=10)

# fit the wrapper
wrapper.fit(X, y)

# get the predicted probabilities for the positive class
selected_columns, random_elements = wrapper.predict_proba(X)

# get the fancy output dataframe - contains sampled probabilities, the sampled model and the greedy model, etc.
print(wrapper.get_fancy_output_df().head())

Demo

The demo folder contains Jupyter notebooks that shows how to use the package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galileo_forecast-0.1.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galileo_forecast-0.1.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file galileo_forecast-0.1.3.tar.gz.

File metadata

  • Download URL: galileo_forecast-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/23.5.0

File hashes

Hashes for galileo_forecast-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9e4d994d2e7541d694f7bda284cff85e52ee3b29f1e48c861479644c5e5b3166
MD5 f54bc297f4d9dcb886df9e5f3a8dfd50
BLAKE2b-256 c48dddd703010d4bb4891321e5dad2611db5d8d588043240c1730bc8f4e70a19

See more details on using hashes here.

File details

Details for the file galileo_forecast-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: galileo_forecast-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/23.5.0

File hashes

Hashes for galileo_forecast-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d44e39b84f7fca73be115adb6a7a8077acda25403fdc06d9facded0b4f931fbc
MD5 710e7c73d63eddf2f173c671f8739865
BLAKE2b-256 340058ac0f25f40d68e541b06bf6832b3c814b7ff714f526d191c562031095c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page