Skip to main content

A custom prediction library with automated hyperparameter tuning, training utilities, exponential smoothing, and visualisation.

Project description

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.

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

custom_prediction_library-0.3.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

custom_prediction_library-0.3.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file custom_prediction_library-0.3.1.tar.gz.

File metadata

File hashes

Hashes for custom_prediction_library-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3d24b6117056f4112f8bb0296c0fba218ae0dc216e0e70f322aacc0ae5a9f843
MD5 dcd52d5029028dc7a71d0a192295a23d
BLAKE2b-256 be111bc910d3a3b82cbedf130196e63b8d61426bc08ade2022e699d36776d04a

See more details on using hashes here.

File details

Details for the file custom_prediction_library-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for custom_prediction_library-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3cff2cf574626031d85eacdaba8867163eec532d322b5c345314fe6d465754d
MD5 857d0cd660735c5bbe3382d98580e247
BLAKE2b-256 0641ff844b0a3fb1778093a629318c2c1a4fb67145c4fa1371df9f82206024c8

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