Skip to main content

Custom Prediction Library

A Python library for:

  • Simplified model creation using Scikit-learn.
  • Automated hyperparameter tuning with Optuna and Bayesian Optimization.
  • Time series forecasting using Exponential Smoothing.
  • Interactive visualisation with Bokeh.

Installation

Install via pip:

pip install custom_prediction_lib

Features

  • Model Factory: Create classification and regression models with minimal setup.
  • Hyperparameter Tuning: Includes GridSearch, RandomizedSearch, and advanced tuning with Optuna.
  • Time Series: Exponential smoothing for forecasting.
  • Visualisation: Interactive plots for predictions and forecasts.

Usage

Example 1: Model Factory

from custom_prediction_lib.model_creation import ModelFactory

# Create a Random Forest classifier
model = ModelFactory.create_model(
    task="classification", 
    model_type="random_forest", 
    n_estimators=100
)

Example 2: Hyperparameter Tuning

from custom_prediction_lib.tuning import HyperparameterTuner
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification

X, y = make_classification(n_samples=500, n_features=10, random_state=42)

model = RandomForestClassifier(random_state=42)
param_distributions = {
    "n_estimators": (50, 200),
    "max_depth": (5, 20),
}

best_model, best_params = HyperparameterTuner.optuna_search(
    model, X, y, param_distributions, n_trials=30, visualise=True
)

Example 3: Time Series Forecasting

from custom_prediction_lib.time_series import ExponentialSmoothingModel

# Example time series data
data = [100, 120, 130, 125, 135, 140, 145]

# Fit and forecast using exponential smoothing
model = ExponentialSmoothingModel(trend="add", seasonal="mul", seasonal_periods=4)
model.fit(data)
forecast = model.forecast(steps=3)
model.plot(data, forecast_steps=3)

License

This project is licensed under the MIT License.

Metadata

Release files for custom-prediction-library 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for custom-prediction-library 0.3.1
File Size Uploaded
custom_prediction_library-0.3.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for custom-prediction-library 0.3.1
File Interpreter ABI Platform
custom_prediction_library-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / custom_prediction_library-0.3.1.tar.gz

Download URL custom_prediction_library-0.3.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d24b6117056f4112f8bb0296c0fba218ae0dc216e0e70f322aacc0ae5a9f843
BLAKE2b-256 checksum
How to use checksums
be111bc910d3a3b82cbedf130196e63b8d61426bc08ade2022e699d36776d04a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / custom_prediction_library-0.3.1-py3-none-any.whl

Download URL custom_prediction_library-0.3.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3cff2cf574626031d85eacdaba8867163eec532d322b5c345314fe6d465754d
BLAKE2b-256 checksum
How to use checksums
0641ff844b0a3fb1778093a629318c2c1a4fb67145c4fa1371df9f82206024c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page