Skip to main content

AI-powered data science assistant — from raw data to trained models.

Project description

DRUID

AI-powered data science assistant — from raw data to trained models.

DRUID is a Python library that combines automated data analysis with large language models to guide you through the entire machine learning workflow. Load your data, and DRUID inspects it, surfaces quality issues, recommends preprocessing steps, generates visualisations, runs model experiments, and explains the results — all with a few lines of code.

Why DRUID?

Data scientists spend 60–80% of their time on data understanding and preparation. DRUID automates the mechanical parts while using AI to surface the insights that matter.

  • Load anything — CSV, Parquet, Excel, JSON, BigQuery, PostgreSQL. Auto-detected.
  • AI schema inspection — Spots data quality issues, type mismatches, and potential label leakage before you start.
  • Guided EDA — Generates the right visualisations for your data and explains what they mean.
  • One-line preprocessing — Handles missing values, outliers, encoding, and feature engineering with sensible defaults.
  • Model experimentation — Trains and compares multiple algorithms in one call. Shows a ranked leaderboard.
  • Multi-provider AI — Works with OpenAI, Anthropic (Claude), or Google (Gemini). Bring your own API key.
  • Fully reproducible — Every step is logged. Export the session as a standalone Python script anytime.

Installation

pip install druid-ai

With AI providers:

pip install druid-ai[openai]      # OpenAI (GPT-4o, etc.)
pip install druid-ai[anthropic]   # Anthropic (Claude)
pip install druid-ai[google]      # Google (Gemini)
pip install druid-ai[all]         # Everything

Quick Start

import druid

# Configure your AI provider
druid.configure(provider="anthropic")  # or "openai", "google"

# Load data (auto-detects format)
ds = druid.load("transactions.csv", target="is_fraud")

# AI inspects the schema
druid.inspect(ds)

# Exploratory analysis with AI commentary
druid.explore(ds)

# Preprocess in one line
ds = druid.prepare(ds)

# Train and compare models
results = druid.experiment(ds)

# AI recommends next steps
druid.recommend(ds, results)

That's the full workflow. Five function calls from raw data to model comparison.

Supported Data Sources

Source Example
CSV / TSV druid.load("data.csv")
Parquet druid.load("data.parquet")
Excel druid.load("data.xlsx")
JSON / JSONL druid.load("data.json")
BigQuery druid.load("project.dataset.table")
SQL query druid.load("SELECT * FROM users", loaders=[SQLLoader(conn_str)])

AI Providers

DRUID works with any of the three major LLM providers. Set your API key as an environment variable or pass it directly:

# Environment variable (recommended)
# export OPENAI_API_KEY=sk-...
# export ANTHROPIC_API_KEY=sk-ant-...
# export GOOGLE_API_KEY=...

druid.configure(provider="openai")

# Or pass directly
druid.configure(provider="anthropic", api_key="sk-ant-...")

DRUID works without an API key too — you get automated profiling, visualisations, preprocessing, and model experiments. The AI layer adds schema analysis, natural-language insights, and model recommendations on top.

Detailed Usage

Loading Data

ds = druid.load("data.csv", target="label", name="my_dataset")

The DruidDataset wraps your DataFrame with metadata, profiling, and session tracking. Access the raw data anytime with ds.df.

Schema Inspection

result = druid.inspect(ds)

This computes a statistical profile and, if AI is configured, sends it to the LLM for analysis. The AI flags issues like mislabelled columns, suspicious distributions, and potential data leakage.

Exploratory Analysis

eda = druid.explore(ds, question="What separates fraud from non-fraud?")

Generates missing-value plots, distribution histograms, correlation heatmaps, and target analysis. The optional question parameter focuses the AI's commentary.

Preprocessing

# Automatic — sensible defaults
ds = druid.prepare(ds)

# Manual — full control
from druid.preprocessing import (
    auto_clean, featurize_datetime, treat_outliers,
    encode_categoricals, bin_numeric,
)

ds = auto_clean(ds)
ds = featurize_datetime(ds, columns=["created_at"])
ds = treat_outliers(ds, method="iqr", fold=1.5)
ds = encode_categoricals(ds, high_card_threshold=15)

Model Experiments

results = druid.experiment(ds)

Trains Logistic Regression, Random Forest, Gradient Boosting, AdaBoost, Decision Tree, KNN, and SGD out of the box. If xgboost or lightgbm are installed, those are included automatically.

The leaderboard shows accuracy, F1, precision, recall, ROC AUC, and training time for each model.

AI Recommendations

druid.recommend(ds, results)

Passes the experiment results to the AI, which recommends which model to invest in, specific hyperparameters to tune, and strategies for handling class imbalance or other issues.

Reproducibility

# Export session as a Python script
from druid.utils import export_script
export_script(ds, "pipeline.py")

# Save and reload datasets
from druid.utils import save_dataset, load_dataset
save_dataset(ds, "checkpoint.pkl")
ds = load_dataset("checkpoint.pkl")

Configuration

from druid import DruidConfig, AIConfig

config = DruidConfig(
    ai=AIConfig(
        provider="anthropic",
        model="claude-sonnet-4-20250514",
        temperature=0.3,
    ),
)

# Or load from YAML
config = DruidConfig.from_yaml("druid_config.yaml")

Project Structure

druid/
├── core/          # DruidDataset, config, session tracking
├── loaders/       # File, database, and auto-detect loaders
├── ai/            # LLM providers, prompts, schema inspector
├── eda/           # Profiling, visualisation, AI insights
├── preprocessing/ # Cleaning, transforms, encoding, pipelines
├── modelling/     # Experiments, evaluation, AI recommendations
└── utils/         # Display, sampling, export tools

Requirements

  • Python ≥ 3.9
  • pandas, numpy, scikit-learn, matplotlib, seaborn
  • feature-engine, missingno, rich, httpx, pyyaml

AI providers and database connectors are optional extras.

Development

git clone https://github.com/Lekewhite01/druid.git
cd druid
pip install -e ".[dev]"
pytest

License

MIT — see LICENSE for details.

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

druid_ai-0.1.2.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

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

druid_ai-0.1.2-py3-none-any.whl (48.0 kB view details)

Uploaded Python 3

File details

Details for the file druid_ai-0.1.2.tar.gz.

File metadata

  • Download URL: druid_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for druid_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 498ed29a1ef970a086928a81d1f9b43652b5a64b7b1993f9338260eb0380cfb3
MD5 341c90565765d4ef77493d784043a420
BLAKE2b-256 fc44cf150c7e63973c8f0b5bf40567ee0b2cd94f04213c4686c4dd842a44ca81

See more details on using hashes here.

File details

Details for the file druid_ai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: druid_ai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 48.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for druid_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a84eea1c6faffbb91eb82ec50d99b7e142ae3613bad29399c0721621268f243
MD5 a55e7081537f2f2c263e5a077e5dc082
BLAKE2b-256 b50850f51ab03befa46684400505f2b2ee454e35091efd45ee8091d4ea1ad99c

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