Skip to main content

The most advanced modular machine learning library in Python

Project description

Raikura

Raikura is an advanced, modular Python library for machine learning that extends beyond the traditional capabilities of scikit-learn. It integrates classical ML models, deep learning, transformers, time series forecasting, fairness auditing, AutoML pipelines, and model interpretability โ€” all in a production-ready, extensible architecture.

Raikura is designed for researchers, engineers, and builders who want control, flexibility, and intelligence in one place.


๐Ÿ“š Philosophy

Raikura is structured around these design principles:

  • Modularity: You can use only what you need โ€” from preprocessing to full AutoML pipelines.
  • Extensibility: Add your own models, metrics, or transformations with minimal friction.
  • Explainability-first: SHAP, LIME, and Captum are built-in for responsible AI development.
  • Multi-modal: Combine tabular, text, and image data in one pipeline.
  • Reproducibility: Config-based pipelines, serialization, and audit logging ensure traceable results.

โšก Capabilities Overview

๐Ÿ”จ Modeling

  • Classical: Logistic Regression, Random Forest, SVM, Gradient Boosting, etc.
  • Tree Boosting: XGBoost, LightGBM with auto-hyperparameter tuning
  • Deep Learning: PyTorch MLPs and CNNs for tabular and image tasks
  • NLP: Transformer models from HuggingFace for classification tasks

๐Ÿงฑ Preprocessing

  • Auto column classification: numeric, categorical, text, datetime
  • Feature scaling, one-hot and ordinal encoding
  • TF-IDF/Count vectorization for text
  • Polynomial and interaction features with custom degrees
  • Lag and rolling-window features for time series

๐ŸŽฏ Metrics

  • Classification: Accuracy, Precision, Recall, F1, ROC-AUC, Log-loss
  • Regression: MAE, MSE, RMSE, R2
  • Visuals: Confusion Matrix, ROC curves, metric plots

๐Ÿง  Explainability

  • SHAP: global and local explanations for any model
  • LIME: instance-level perturbation insights
  • Captum: saliency and attribution for PyTorch-based models

๐Ÿ“ˆ Time Series

  • Lag and rolling features
  • Time-based train/test splits and CV
  • Prophet forecasting wrapper
  • Hybrid classical + DL time series modeling

๐Ÿ”ฌ Fairness & Bias Auditing

  • TPR/FPR/precision/recall by group
  • Parity ratios for protected attributes
  • Disparate impact calculations

โš™๏ธ Automation

  • Full YAML-configured training pipelines
  • CLI and REST API interfaces
  • Config tracking, hashing, and versioning
  • Model + config + feature saving

๐Ÿ”ง Installation

pip install raikura

Requires Python 3.8+ and pip. Some components (like Prophet or Torch) require platform-specific setup.


โœจ Quick Start (Python)

from raikura import AutoMLPipeline, DataLoader

# Load data
df_loader = DataLoader()
X, y = df_loader.load_csv("data/train.csv", target="label")

# Train model
pipe = AutoMLPipeline(model_type="random_forest")
pipe.configure(
    preprocessing={
        "expand_polynomial": True,
        "poly_degree": 2
    }
)
pipe.train(X, y)

๐Ÿงช CLI Usage

raikura train --config config.yaml

Example config.yaml

data:
  path: data/train.csv
  target: label

model:
  type: logistic_regression
  params: {}

task: classification
problem: tabular

preprocessing:
  expand_polynomial: true
  poly_degree: 2
  poly_interaction_only: false

output:
  model_path: outputs/model.pkl
  columns_path: outputs/columns.pkl

๐ŸŒ REST API (FastAPI)

uvicorn raikura.core.api:app --reload

Endpoints

Method Endpoint Purpose
POST /predict Run predictions
POST /evaluate Evaluate with ground truth
GET /info Model metadata

Send JSON payloads with columns and data keys.


๐Ÿ” Directory Structure

raikura/
โ”œโ”€โ”€ cli.py               # CLI entrypoint
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ models.py        # Model factory
โ”‚   โ”œโ”€โ”€ pipeline.py      # AutoML logic
โ”‚   โ”œโ”€โ”€ train.py         # DL and transformers
โ”‚   โ”œโ”€โ”€ tuner.py         # Hyperparameter tuning
โ”‚   โ”œโ”€โ”€ preprocess.py    # Full preprocessing suite
โ”‚   โ”œโ”€โ”€ metrics.py       # Metrics & evaluation
โ”‚   โ”œโ”€โ”€ explain.py       # SHAP, LIME, Captum
โ”‚   โ”œโ”€โ”€ fusion.py        # Multi-modal models
โ”‚   โ”œโ”€โ”€ timeseries.py    # Time series tools
โ”‚   โ”œโ”€โ”€ audit.py         # Fairness auditing
โ”‚   โ”œโ”€โ”€ data.py          # Loading & splitting
โ”‚   โ”œโ”€โ”€ utils.py         # Seeding, saving, logging
โ”‚   โ””โ”€โ”€ api.py           # FastAPI serving

๐Ÿงฐ Advanced Features

๐Ÿง  FusionModel

  • Accepts tabular + image + text data
  • Unified forward pass and joint latent space
  • Useful for medical ML, fraud detection, etc.

๐Ÿงช AutoMLPipeline

  • Wraps training, preprocessing, evaluation
  • Configurable via code or YAML
  • Deep learning and classical interchangeable

๐Ÿ“Š Metric Tracking

  • Logs reports per epoch or fold
  • Confusion matrix, F1, precision recall
  • Visualizations available in metrics.py

๐Ÿ“Š Example: Fairness Audit

from raikura import FairnessAudit

audit = FairnessAudit(sensitive_col="gender", privileged_group="male")
results = audit.evaluate(df_with_preds)
impact = audit.disparate_impact(df_with_preds)

๐Ÿงช Testing

Run tests using:

python -m unittest discover tests/

๐Ÿ™Œ Contribute

  • Fork and PR on GitHub
  • Submit feature requests
  • Help expand time series and multi-modal examples

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

raikura-0.1.1.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

raikura-0.1.1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file raikura-0.1.1.tar.gz.

File metadata

  • Download URL: raikura-0.1.1.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for raikura-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fa6b5718a012397d5275d9ce99edce272e6c4dd1bf3e79b738c4e289369c485d
MD5 ef1f5e7e7191cae4374b1f4a9e54be8e
BLAKE2b-256 b7d463e17833f25ae30a849479507ef89033d1bbe2b7bea0337dedc9f3cdaf32

See more details on using hashes here.

File details

Details for the file raikura-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: raikura-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for raikura-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39d4ea6066ffe3fa48e6aa4b2e239b8becdb7b0e7fb44fd72fcc5c54f6e7431b
MD5 345e61744a9ee1ccb335c7363add0903
BLAKE2b-256 5c3ae9224dc24aa33faafb6c5f26ed2f340986caa4efb917276d0f16c6905f8d

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