Metadata-Version: 2.2
Name: gbmframework
Version: 0.1.0
Summary: A unified framework for Gradient Boosting Models with SHAP analysis
Home-page: https://github.com/yourusername/gbmframework
Author: Mark Attwood + Claude 3.7
Author-email: "Mark Attwood + Claude 3.7" <attwoodanalytics@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/AttwoodData/gbmframework
Project-URL: Bug Tracker, https://github.com/AttwoodData/gbmframework/issues
Project-URL: Documentation, https://github.com/AttwoodData/gbmframework#readme
Project-URL: Source Code, https://github.com/AttwoodData/gbmframework
Keywords: machine learning,gradient boosting,xgboost,lightgbm,catboost,shap
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: hyperopt>=0.2.7
Requires-Dist: joblib>=1.1.0
Requires-Dist: tqdm>=4.62.0
Requires-Dist: psutil>=5.9.0
Provides-Extra: xgboost
Requires-Dist: xgboost>=1.5.0; extra == "xgboost"
Provides-Extra: lightgbm
Requires-Dist: lightgbm>=3.3.0; extra == "lightgbm"
Provides-Extra: catboost
Requires-Dist: catboost>=1.0.0; extra == "catboost"
Provides-Extra: shap
Requires-Dist: shap>=0.40.0; extra == "shap"
Provides-Extra: all
Requires-Dist: xgboost>=1.5.0; extra == "all"
Requires-Dist: lightgbm>=3.3.0; extra == "all"
Requires-Dist: catboost>=1.0.0; extra == "all"
Requires-Dist: shap>=0.40.0; extra == "all"
Provides-Extra: parallel
Requires-Dist: pymongo>=4.0.0; extra == "parallel"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.10.0; extra == "dev"
Requires-Dist: flake8>=4.0.0; extra == "dev"
Requires-Dist: mypy>=0.9.0; extra == "dev"
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=4.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
Requires-Dist: nbsphinx>=0.8.0; extra == "docs"
Requires-Dist: ipython>=7.0.0; extra == "docs"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# GBM Framework

A unified framework for Gradient Boosting Models with SHAP analysis and system optimization.

## Features

- Support for multiple GBM implementations (XGBoost, LightGBM, CatBoost, Random Forest)
- Automated hyperparameter optimization with hyperopt
- Intelligent system resource detection and optimization
- Standardized evaluation metrics and visualization
- SHAP value integration for model explainability
- Simple, consistent API for model training and evaluation

## Installation

Basic installation:
```bash
pip install gbmframework
```

With specific boosting libraries:
```bash
pip install gbmframework[xgboost]    # With XGBoost
pip install gbmframework[lightgbm]   # With LightGBM
pip install gbmframework[catboost]   # With CatBoost
pip install gbmframework[hyperopt]   # With Hyperopt for optimization
pip install gbmframework[all]        # All dependencies
```

## Quick Start

```python
import numpy as np
import pandas as pd
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

# Import gbmframework components
from gbmframework.models import train_xgboost, train_lightgbm, train_catboost, train_random_forest
from gbmframework.optimizer import SystemOptimizer
from gbmframework.evaluation import evaluate_classification_model
from gbmframework.shap_utils import generate_shap_values, visualize_shap

# Load and split data
breast_cancer = load_breast_cancer()
X = pd.DataFrame(breast_cancer.data, columns=breast_cancer.feature_names)
y = breast_cancer.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize system optimizer for efficient resource usage
optimizer = SystemOptimizer(enable_parallel=True, verbose=True)

# Train XGBoost model with hyperparameter optimization
result = train_xgboost(
    X_train, y_train, X_test, y_test,
    max_evals=10,  # Number of hyperopt trials
    optimizer=optimizer  # Pass the optimizer for resource management
)

# Access the best model and evaluate
model = result['model']
print(f"Best AUC: {result['best_score']:.4f}")

# Generate SHAP values for model interpretability
shap_result = generate_shap_values(
    model=model,
    X=X_test.iloc[:100],  # Use a subset for SHAP analysis
    algorithm_type='xgboost',
    optimizer=optimizer
)

# Visualize feature importance
visualize_shap(
    shap_result=shap_result,
    plot_type='bar',
    plot_title='XGBoost Feature Importance',
    optimizer=optimizer
)

# Clean up any resources
optimizer.cleanup()
```

## Documentation

For more information, see the [documentation](https://github.com/yourusername/gbmframework) or the examples directory.
