Structured AutoML Pipeline with Intelligent Dataset Profiling
Project description
๐ OctoLearn
Enterprise-Grade AutoML for Python
Profile โ Clean โ Engineer โ Train โ Report โ in one line of code.
Quick Start โข Features โข Installation โข Advanced Usage โข API Reference โข Architecture
โจ Features
| Feature | Description |
|---|---|
| ๐ Smart Profiling | Auto-detects column types, task type, leakage suspects, class imbalance |
| ๐งน Auto Cleaning | Imputation, encoding, scaling โ all learned on train, applied to test |
| โ ๏ธ Risk Scoring | 0โ100 data quality risk score with detailed factor breakdown |
| ๐ง Feature Engineering | Outlier detection (IQR, Z-score, Isolation Forest) + interaction analysis |
| ๐ค Model Training | Trains 5+ models with Optuna hyperparameter optimization |
| ๐ PDF Reports | Professional cyberpunk-themed reports with charts & SHAP analysis |
| ๐พ Model Registry | Version-controlled model storage with metadata tracking |
| โก Parallel Processing | Multi-core support for faster training and optimization |
๐ฆ Installation
From Source (Development)
git clone https://github.com/GhulamMuhammadNabeel/OctoLearn.git
cd OctoLearn
python -m venv .venv
# Windows
.\.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
pip install -e .
Dependencies
OctoLearn requires Python 3.8+ and installs the following:
| Package | Purpose |
|---|---|
pandas, numpy |
Data manipulation |
scikit-learn |
ML models & preprocessing |
optuna |
Hyperparameter optimization |
reportlab |
PDF report generation |
matplotlib, seaborn |
Visualization |
shap |
Model explainability |
joblib |
Model serialization |
๐ Quick Start
For Beginners โ One Line Pipeline
from octolearn import AutoML
import pandas as pd
# Load your data
data = pd.read_csv("your_data.csv")
X = data.drop("target_column", axis=1)
y = data["target_column"]
# Run the entire pipeline
automl = AutoML()
automl.fit(X, y)
# Get results
print(automl.raw_profile_) # Dataset profiling results
print(automl.get_risk_score()) # Data quality risk score
print(automl.get_recommendations()) # ML recommendations
Profile Only (No Training)
automl = AutoML(train_models=False)
automl.fit(X, y)
# Access insights
profile = automl.raw_profile_
print(f"Rows: {profile.n_rows}, Columns: {profile.n_columns}")
print(f"Task type: {profile.task_type}")
print(f"Missing values: {profile.missing_ratio}")
# Risk assessment
risk = automl.get_risk_score()
print(f"Risk: {risk['score']}/100 ({risk['category']})")
Generate a PDF Report
automl = AutoML()
automl.fit(X, y)
automl.generate_report() # Creates a professional PDF report
๐ง Advanced Usage
Full Configuration Control
Every aspect of OctoLearn is configurable through dataclass objects:
from octolearn import (
AutoML,
DataConfig,
ProfilingConfig,
PreprocessingConfig,
ModelingConfig,
OptimizationConfig,
ReportingConfig,
ParallelConfig,
)
automl = AutoML(
# Data handling
data_config=DataConfig(
use_full_data=False, # Sample large datasets
sample_size=1000, # Rows to sample
test_size=0.2, # Train/test split ratio
random_state=42, # Reproducibility
),
# Profiling behavior
profiling_config=ProfilingConfig(
detect_outliers=True,
analyze_interactions=True, # Enable interaction analysis
generate_risk_score=True,
calculate_feature_importance=True,
),
# Preprocessing strategy
preprocessing_config=PreprocessingConfig(
auto_clean=True,
imputer_strategy={"numeric": "median", "categorical": "mode"},
scaler="standard", # "standard", "minmax", "robust", or None
id_columns=["user_id"], # Columns to remove
),
# Model training
modeling_config=ModelingConfig(
train_models=True,
n_models=5,
models_to_train=["random_forest", "xgboost", "logistic_regression"],
),
# Hyperparameter tuning
optimization_config=OptimizationConfig(
use_optuna=True,
optuna_trials_per_model=30,
optuna_timeout_seconds=600,
),
# Report settings
reporting_config=ReportingConfig(
generate_report=True,
report_detail="detailed", # "brief" or "detailed"
include_shap=True,
plot_mode="simple", # "simple" or "dashboard"
),
# Parallel processing
parallel_config=ParallelConfig(
parallel_processing=True,
n_jobs=-1, # -1 = all cores
backend="threading",
),
)
automl.fit(X, y)
Using Individual Components
OctoLearn's components can be used independently:
Data Profiling
from octolearn.profiling import DataProfiler
profiler = DataProfiler()
profile = profiler.profile(X, y)
print(f"Shape: {profile.shape}")
print(f"Numeric columns: {profile.numeric_columns}")
print(f"Categorical columns: {profile.categorical_columns}")
print(f"ID-like columns: {profile.id_like_columns}")
print(f"Leakage suspects: {profile.leakage_suspects}")
print(f"Class imbalance ratio: {profile.imbalance_ratio}")
Auto Cleaning
from octolearn.preprocessing.auto_cleaner import AutoCleaner
cleaner = AutoCleaner(
imputer_strategy={"numeric": "median"},
scaler="robust"
)
X_clean, y_clean, cleaning_log = cleaner.fit_transform(X_train, y_train)
# Apply same cleaning to test data
X_test_clean = cleaner.transform(X_test)
Model Registry
from octolearn.models.registry import ModelRegistry
registry = ModelRegistry(base_dir="./models")
registry.register(model, name="xgboost_v1", metrics={"accuracy": 0.95})
# Load best model later
best = registry.get_best_model(metric="accuracy")
Backward Compatibility
Legacy parameter names are supported via **kwargs:
# Both of these work identically:
AutoML(train_models=False)
AutoML(modeling_config=ModelingConfig(train_models=False))
๐ API Reference
AutoML โ Main Orchestrator
| Method | Description |
|---|---|
fit(X, y) |
Run the complete pipeline |
predict(X_new) |
Make predictions using best model |
generate_report() |
Generate PDF report |
get_risk_score() |
Get data quality risk score (0-100) |
get_recommendations() |
Get ML recommendations |
get_feature_importance() |
Get feature importance scores |
get_preprocessing_suggestions() |
Get preprocessing advice |
get_model_benchmarks() |
Get all model metrics |
| Attribute | Description |
|---|---|
raw_profile_ |
DatasetProfile of raw data |
clean_profile_ |
DatasetProfile of cleaned data |
X_, y_ |
Cleaned feature matrix and target |
X_train_, X_test_ |
Train/test splits |
cleaning_log_ |
Dictionary of cleaning operations |
outlier_results_ |
Outlier detection results |
trained_models_ |
Dictionary of trained models |
best_model_ |
Best performing model |
Configuration Dataclasses
DataConfig
| Field | Type | Default | Description |
|---|---|---|---|
use_full_data |
bool |
False |
Use entire dataset (no sampling) |
sample_size |
int |
500 |
Rows to sample if not using full data |
test_size |
float |
0.2 |
Fraction for test split |
random_state |
int |
42 |
Random seed for reproducibility |
stratify_target |
bool |
True |
Stratify split on target |
ProfilingConfig
| Field | Type | Default | Description |
|---|---|---|---|
detect_outliers |
bool |
True |
Run outlier detection |
analyze_interactions |
bool |
False |
Analyze feature interactions |
generate_risk_score |
bool |
True |
Calculate risk score |
calculate_feature_importance |
bool |
True |
Compute importance |
generate_recommendations |
bool |
True |
Generate ML recommendations |
include_duplicates_analysis |
bool |
True |
Analyze duplicates |
PreprocessingConfig
| Field | Type | Default | Description |
|---|---|---|---|
auto_clean |
bool |
True |
Enable auto cleaning |
imputer_strategy |
Dict |
None |
Imputation methods per type |
encoder_strategy |
Dict |
None |
Encoding strategy |
scaler |
str |
"standard" |
Scaling method |
id_columns |
List[str] |
None |
Columns to remove |
ModelingConfig
| Field | Type | Default | Description |
|---|---|---|---|
train_models |
bool |
True |
Whether to train models |
models_to_train |
List[str] |
None |
Specific models to train |
evaluation_metric |
str |
None |
Primary evaluation metric |
n_models |
int |
5 |
Number of models to train |
test_size |
float |
0.2 |
Test split ratio |
OptimizationConfig
| Field | Type | Default | Description |
|---|---|---|---|
use_optuna |
bool |
True |
Enable Optuna tuning |
optuna_trials_per_model |
int |
20 |
Trials per model |
optuna_timeout_seconds |
int |
300 |
Timeout per model |
optuna_parallel_jobs |
int |
-1 |
Parallel Optuna workers |
use_registry |
bool |
True |
Save models to registry |
ReportingConfig
| Field | Type | Default | Description |
|---|---|---|---|
generate_report |
bool |
True |
Generate PDF report |
report_detail |
str |
"detailed" |
"brief" or "detailed" |
include_shap |
bool |
True |
Include SHAP analysis |
plot_mode |
str |
"simple" |
"simple" or "dashboard" |
visuals_limit |
int |
10 |
Max plots in report |
ParallelConfig
| Field | Type | Default | Description |
|---|---|---|---|
parallel_processing |
bool |
True |
Enable parallelism |
n_jobs |
int |
-1 |
Number of cores (-1 = all) |
backend |
str |
"threading" |
Joblib backend |
verbose |
int |
0 |
Verbosity level |
๐๏ธ Architecture
octolearn/
โโโ __init__.py # Public API exports
โโโ config.py # Centralized configuration constants
โโโ core.py # AutoML orchestrator (main entry point)
โ
โโโ profiling/
โ โโโ data_profiler.py # DataProfiler + DatasetProfile
โ
โโโ preprocessing/
โ โโโ auto_cleaner.py # AutoCleaner (impute/encode/scale)
โ โโโ pipeline_builder.py # sklearn Pipeline export
โ
โโโ models/
โ โโโ model_trainer.py # ModelTrainer + Optuna integration
โ โโโ registry.py # ModelRegistry (versioned storage)
โ
โโโ evaluation/
โ โโโ metrics.py # ModelEvaluator (classification/regression)
โ
โโโ experiments/
โ โโโ report_generator.py # PDF report generation
โ โโโ plot_generator.py # Visualization engine
โ โโโ recommendation_engine.py # ML recommendations
โ โโโ risk_scorer.py # Data quality risk scoring
โ โโโ outlier_detector.py # Multi-method outlier detection
โ โโโ baseline_importance.py # Feature importance
โ โโโ preprocessing_suggester.py # Preprocessing advice
โ
โโโ feature/
โ โโโ interaction_analyzer.py # Feature interaction analysis
โ
โโโ utils/
โโโ helpers.py # Logging, decorators, validation
Pipeline Flow
Raw Data โโโบ Profiling โโโบ Train/Test Split โโโบ Auto Cleaning โโโบ Clean Profiling
โ
โผ
PDF Report โโโ Model Training โโโ Feature Engineering
โ
โผ
Optuna Optimization โโโบ Model Registry
The pipeline executes 6 phases:
- Profiling โ Infer types, detect quality issues, estimate task type
- Splitting โ Stratified train/test split
- Cleaning โ Impute missing values, encode categoricals, scale numerics
- Clean Profiling โ Re-profile the cleaned dataset
- Feature Engineering โ Outlier detection + interaction analysis
- Model Training โ Train multiple models with optional Optuna HPO
๐งช Running Tests
# Activate virtual environment first
python test_complete_pipeline.py
This exercises all pipeline phases with the Titanic dataset.
๐ License
MIT License โ see LICENSE for details.
๐ค Author
Ghulam Muhammad Nabeel
Built with โค๏ธ by the OctoLearn team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file octolearn-0.7.7.tar.gz.
File metadata
- Download URL: octolearn-0.7.7.tar.gz
- Upload date:
- Size: 842.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa10095846560428dc198cc6dcd6e2a5bfae153c6bfcbc4ac9b50181418f520b
|
|
| MD5 |
5d7ffc8c8ff4d871808ec986565e1b38
|
|
| BLAKE2b-256 |
cb1e36a7ff8d3284bb0f97e40240c78f7c7f9c68b59201eb096eb25c0d26ef2b
|
File details
Details for the file octolearn-0.7.7-py3-none-any.whl.
File metadata
- Download URL: octolearn-0.7.7-py3-none-any.whl
- Upload date:
- Size: 837.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cad1c9d1c4794295206cf3ba02075f1a9e2f37a9ce5d258ce3a7d483992da44
|
|
| MD5 |
2d6648ad4e212121d1496e36a6905d98
|
|
| BLAKE2b-256 |
7f9c8c7b52a4986dbc057dbecca13a3ad96f30c0454986201956cf94e2447d6c
|