Pushppp/pkboost-terminal-documentation
0
1<!DOCTYPE html>2<html lang="en">3<head>4 <meta charset="UTF-8">5 <meta name="viewport" content="width=device-width, initial-scale=1.0">6 <title>PKBoost Python Package</title>7 <link rel="icon" type="image/x-icon" href="/static/favicon.ico">8 <link rel="stylesheet" href="style.css">9 <script src="https://cdn.tailwindcss.com"></script>10 <script>11 tailwind.config = {12 theme: {13 extend: {14 colors: {15 background: '#0D0D0D',16 accent: '#DE4F1F',17 text: '#E5E5E5',18 'text-secondary': '#8B949E'19 },20 fontFamily: {21 'mono': ['JetBrains Mono', 'monospace'],22 'sans': ['Inter', 'sans-serif']23 }24 }25 }26 }27 </script>28 <link rel="preconnect" href="https://fonts.googleapis.com">29 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>30 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">31</head>32<body class="bg-background text-text min-h-screen flex flex-col">33 <main class="flex-1 px-4 py-12 max-w-6xl mx-auto">34 <!-- Logo and Header -->35 <div class="text-center mb-12 fade-up">36 <div class="mb-8">37 <img width="150" height="150" alt="PKBoost Logo" src="https://huggingface.co/spaces/Pushppp/pkboost-terminal-documentation/resolve/main/images/Black%20Simple%20Personal%20Logo.png" class="mx-auto opacity-90">38 </div>39 <h1 class="text-4xl sm:text-6xl font-black mb-4 tracking-tight">40 <span class="text-accent">PK</span><span>BOOST</span>41 </h1>42 <p class="font-sans text-xl sm:text-2xl text-text-secondary mb-8">43 Python Package Documentation44 </p>45 </div>46 47 <!-- Main Content -->48 <div class="prose prose-invert max-w-none">49 <p class="font-sans text-lg text-text-secondary mb-8">50 The official Python wrapper for PKBoost, providing seamless integration with Python's machine learning ecosystem.51 </p>52 <!-- Badges -->53 <div class="flex flex-wrap gap-4 mb-8 justify-center">54 <a href="https://www.rust-lang.org/" target="_blank" class="inline-block">55 <img src="https://img.shields.io/badge/Rust-000000?logo=rust&logoColor=white&style=for-the-badge" alt="Rust">56 </a>57 <a href="https://pypi.org/project/pkboost/" target="_blank" class="inline-block">58 <img src="https://img.shields.io/pypi/v/pkboost?color=blue&logo=pypi&logoColor=white&style=for-the-badge" alt="PyPI">59 </a>60 <a href="https://pypi.org/project/pkboost/" target="_blank" class="inline-block">61 <img src="https://img.shields.io/pypi/dm/pkboost?color=brightgreen&style=for-the-badge" alt="Downloads">62 </a>63 <a href="LICENSE" target="_blank" class="inline-block">64 <img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" alt="MIT License">65 </a>66 <a href="https://github.com/Pushp-Kharat1/PKBoost/stargazers" target="_blank" class="inline-block">67 <img src="https://img.shields.io/github/stars/Pushp-Kharat1/PKBoost?style=for-the-badge&logo=github" alt="GitHub Stars">68 </a>69 </div>70<!-- Installation Section -->71 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">๐ฆ Installation</h2>72 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">73 <pre class="font-mono text-sm"><code>pip install pkboost</code></pre>74 </div>75 76 <!-- Quick Start Section -->77 <h2 class="font-mono text-3xl text-accent mb-6">๐ Quick Start</h2>78 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">79 <pre class="font-mono text-sm"><code>import pkboost80import pandas as pd81from sklearn.model_selection import train_test_split82from sklearn.metrics import precision_recall_curve, auc83 84# Load your data85data = pd.read_csv('your_data.csv')86X = data.drop('target', axis=1)87y = data['target']88 89# Split the data90X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y)91 92# Create and train PKBoost classifier93model = pkboost.PKBoostClassifier()94model.fit(X_train, y_train)95 96# Make predictions97y_pred_proba = model.predict_proba(X_test)[:, 1]98 99# Evaluate100precision, recall, _ = precision_recall_curve(y_test, y_pred_proba)101pr_auc = auc(recall, precision)102print(f"PR-AUC: {pr_auc:.4f}")</code></pre>103 </div>104 105 <!-- PKBoostClassifier Section -->106 <h2 class="font-mono text-3xl text-accent mb-6">๐ง PKBoostClassifier</h2>107 <p class="font-sans text-text-secondary mb-4">108 The main classifier class with the following parameters:109 </p>110 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">111 <pre class="font-mono text-sm"><code>PKBoostClassifier(112 n_estimators=100,113 learning_rate=0.1,114 max_depth=6,115 min_samples_split=2,116 min_samples_leaf=1,117 subsample=1.0,118 colsample_bytree=1.0,119 reg_lambda=1.0,120 reg_alpha=0.0,121 random_state=None,122 n_jobs=-1,123 verbose=0124)</code></pre>125 </div>126 127 <!-- Key Features -->128 <h3 class="font-mono text-xl text-accent mb-4">โจ Key Features</h3>129 <ul class="font-sans text-text-secondary mb-8 space-y-2">130 <li><strong>Automatic Hyperparameter Tuning</strong>: Use <code>auto_tune=True</code> for automatic configuration</li>131 <li><strong>Early Stopping</strong>: Monitor validation performance with <code>eval_set</code></li>132 <li><strong>Feature Importance</strong>: Access via <code>feature_importances_</code> attribute</li>133 <li><strong>Handles Imbalance</strong>: Built-in class weighting for imbalanced datasets</li>134 </ul>135 136 <!-- Advanced Usage -->137 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">โก Advanced Usage</h2>138 139 <h3 class="font-mono text-xl text-accent mb-4">With Early Stopping</h3>140 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">141 <pre class="font-mono text-sm"><code>from sklearn.model_selection import train_test_split142 143# Split into train, validation, test144X_train, X_temp, y_train, y_temp = train_test_split(X, y, test_size=0.3, stratify=y)145X_val, X_test, y_val, y_test = train_test_split(X_temp, y_temp, test_size=0.5, stratify=y_temp)146 147model = pkboost.PKBoostClassifier(148 n_estimators=1000, # Set high, early stopping will determine actual number149 early_stopping_rounds=50,150 verbose=10151)152 153model.fit(154 X_train, y_train,155 eval_set=[(X_val, y_val)],156 verbose=True157)</code></pre>158 </div>159 160 <h3 class="font-mono text-xl text-accent mb-4">Automatic Hyperparameter Tuning</h3>161 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">162 <pre class="font-mono text-sm"><code>model = pkboost.PKBoostClassifier(auto_tune=True)163model.fit(X_train, y_train)</code></pre>164 </div>165 166 <!-- PKBoostAdaptive Section -->167 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">๐ PKBoostAdaptive</h2>168 <p class="font-sans text-text-secondary mb-4">169 For streaming data and concept drift scenarios:170 </p>171 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">172 <pre class="font-mono text-sm"><code>from pkboost import PKBoostAdaptive173 174# Initialize adaptive model175adaptive_model = PKBoostAdaptive(176 drift_detection_sensitivity=0.01,177 adaptation_rate=0.1,178 max_retraining_interval=1000179)180 181# For streaming data182for batch_X, batch_y in data_stream:183 adaptive_model.partial_fit(batch_X, batch_y)184 185 # Check if drift detected186 if adaptive_model.drift_detected:187 print("Concept drift detected! Model is adapting...")188 189 # Get current predictions190 predictions = adaptive_model.predict_proba(batch_X)</code></pre>191 </div>192 193 <!-- Scikit-Learn Integration -->194 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">๐ Integration with Scikit-Learn</h2>195 196 <h3 class="font-mono text-xl text-accent mb-4">Pipeline Integration</h3>197 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">198 <pre class="font-mono text-sm"><code>from sklearn.pipeline import Pipeline199from sklearn.preprocessing import StandardScaler200from sklearn.impute import SimpleImputer201 202pipeline = Pipeline([203 ('imputer', SimpleImputer(strategy='median')),204 ('scaler', StandardScaler()),205 ('classifier', pkboost.PKBoostClassifier())206])207 208pipeline.fit(X_train, y_train)</code></pre>209 </div>210 211 <!-- Model Persistence -->212 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">๐พ Model Persistence</h2>213 214 <h3 class="font-mono text-xl text-accent mb-4">Save and Load Models</h3>215 <div class="bg-text-secondary/10 border border-text-secondary/30 p-4 rounded-sm mb-8">216 <pre class="font-mono text-sm"><code>import joblib217 218# Save model219joblib.dump(model, 'pkboost_model.pkl')220 221# Load model222loaded_model = joblib.load('pkboost_model.pkl')</code></pre>223 </div>224 225 <!-- Performance Tips -->226 <h2 class="font-mono text-3xl text-accent mb-6 mt-12">๐ Performance Tips</h2>227 <ul class="font-sans text-text-secondary mb-8 space-y-2">228 <li><strong>Data Preprocessing</strong>: Ensure numerical features are scaled and categorical features are encoded</li>229 <li><strong>Early Stopping</strong>: Always use early stopping to prevent overfitting</li>230 <li><strong>Subsampling</strong>: For large datasets, use <code>subsample < 1.0</code> for faster training</li>231 <li><strong>Parallelism</strong>: Set <code>n_jobs=-1</code> to use all available cores</li>232 <li><strong>Memory</strong>: Use <code>float32</code> data types for large datasets</li>233 </ul>234 235 <!-- Navigation Buttons -->236 <div class="flex flex-wrap gap-4 justify-center mt-12">237 <a href="/" class="font-mono border border-accent text-accent py-3 px-8 rounded-sm hover:bg-accent hover:text-background transition-colors duration-300 inline-block text-sm tracking-wide">238 โ BACK TO HOME239 </a>240 <a href="/docs.html" class="font-mono border border-text-secondary/50 text-text-secondary py-3 px-8 rounded-sm hover:bg-text-secondary hover:text-background transition-colors duration-300 inline-block text-sm tracking-wide">241 RUST DOCS โ242 </a>243 <a href="/benchmark.html" class="font-mono border border-green-500 text-green-500 py-3 px-8 rounded-sm hover:bg-green-500 hover:text-background transition-colors duration-300 inline-block text-sm tracking-wide">244 BENCHMARKS โ245 </a>246 </div>247</div>248 </main>249 <footer class="text-center py-8 border-t border-text-secondary/20">250 <div class="flex justify-center space-x-6 mb-4">251 <a href="https://github.com/Pushp-Kharat1/" target="_blank" class="text-text-secondary hover:text-accent transition-colors">252 GitHub253 </a>254 <a href="https://www.linkedin.com/in/pushp-kharat-b4181520b?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app" target="_blank" class="text-text-secondary hover:text-accent transition-colors">255 LinkedIn256 </a>257 <a href="https://www.instagram.com/kharat_pushp?igsh=MTA4czJxM3VkZHQx" target="_blank" class="text-text-secondary hover:text-accent transition-colors">258 Instagram259 </a>260 <a href="mailto:kharatpushp16@outlook.com" class="text-text-secondary hover:text-accent transition-colors">261 Email262 </a>263 </div>264 <p class="font-mono text-xs text-text-secondary">265 ยฉ 2025 Pushp Kharat. MIT License.266 </p>267 </footer>268<script>269 // Simple fade-in animation270 document.addEventListener('DOMContentLoaded', function() {271 const fadeElements = document.querySelectorAll('.fade-up');272 fadeElements.forEach(el => {273 el.style.opacity = '0';274 el.style.transform = 'translateY(10px)';275 });276 277 setTimeout(() => {278 fadeElements.forEach(el => {279 el.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out';280 el.style.opacity = '1';281 el.style.transform = 'translateY(0)';282 });283 }, 100);284 });285 </script>286</body>287</html>