Skip to main content

Phil

representation-guided imputation for missing tabular data

PyPI Python versions License

Representation-guided imputation for missing tabular data — PyPI package philler (import: phil).

Development status: Experimental (0.x). Public APIs may change between minor releases.

Phil runs a grid of imputation strategies, scores each candidate with an Euler Characteristic Transform (ECT) descriptor via the trailed backend, and selects the most representative result.

Impute → Describe → Select → Transform

Installation

pip install philler          # core library
pip install "philler[mcp]"   # + FastMCP server for agents

Quick start

import pandas as pd
from phil import Phil

df = pd.read_csv("data_with_missing.csv")

phil = Phil(samples=30, random_state=42)
imputed_df = phil.fit(df)
new_df = phil.transform(new_data)  # reuse fitted pipeline
MCP server — run sweeps from Claude, Cursor, Gemini CLI, etc.

Install the mcp extra and start the server:

pip install "philler[mcp]"
phil-mcp
# or ephemeral: uv tool run --from "philler[mcp]" phil-mcp

Example Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "phil": {
      "command": "uv tool run",
      "args": ["--from", "philler[mcp]", "phil-mcp"]
    }
  }
}

Key tools: ingest_dataset, characterize_dataset, profile_predictability, generate_research_template, recommend_grid, list_grids, create_config, validate_config, run_imputation_sweep, diagnose_sweep, list_collapse_strategies, inspect_ect_distribution, collapse_ensemble, export_imputed_data.

Agents can read phil://docs/imputation-matrix for grid comparison metadata, use profile_predictability + generate_research_template to separate empirically predictable columns from domain/literature priors (DomainKnowledge), and compare ECT signature collapse strategies (barycenter, trimmed_barycenter, frechet_medoid, euclidean_medoid, mode_medoid, cluster_barycenter, auto). Polars users write to Parquet and ingest the file path.

See docs/source/userGuides/mcp.rst for the full tool table and example dialog. Local end-to-end testing: demos/medical.

Configuration — grids and ECT settings

Imputation grids

Named grids via GridGallery:

Name Methods
default BayesianRidge, DecisionTree, RandomForest, GradientBoosting
sampling DistributionImputer (empirical sampling)
finance IterativeImputer, KNNImputer, SimpleImputer
healthcare KNNImputer, SimpleImputer, IterativeImputer
marketing SimpleImputer, KNNImputer, IterativeImputer
engineering SimpleImputer, KNNImputer, IterativeImputer

Custom grid:

from phil import Phil, ImputationConfig
from sklearn.model_selection import ParameterGrid

config = ImputationConfig(
    methods=["KNNImputer"],
    modules=["sklearn.impute"],
    grids=[ParameterGrid({"n_neighbors": [3, 5, 7]})],
)
phil = Phil(param_grid=config)

ECT descriptor

from phil import Phil, ECTConfig

phil = Phil(config=ECTConfig(num_thetas=64, radius=1.0, resolution=100, scale=500, normalize=True, seed=42))
scikit-learn pipelines
from sklearn.pipeline import Pipeline
from sklearn.ensemble import RandomForestClassifier
from phil import PhilTransformer

pipe = Pipeline([
    ("imputer", PhilTransformer(samples=20, random_state=0)),
    ("model", RandomForestClassifier()),
])
pipe.fit(X_train, y_train)
What's new in v1.1.0
  • FastMCP server — phil-mcp exposes the imputation sweep pipeline as MCP tools for agents.
  • Grid recommender — recommend_grid, declarative GridMetadata, and the phil://docs/imputation-matrix resource.
  • Medical demo — demos/medical with covariate sampling, masked iterative imputation, and MDS visualization of descriptor space.

See CHANGELOG.md for full release notes.

Development
uv sync --all-extras
uv run pytest -v
uvx ruff format phil/ tests/
uvx ruff check phil/ tests/

Contributors: see AGENTS.md for package layout and design notes.

Documentation

Sphinx docs live under docs/source. Build locally:

uv run sphinx-build -M html docs/source docs/build

Made by Krv Labs

Metadata

Release files for philler 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for philler 0.1.0
File Size Uploaded Provenance
philler-0.1.0.tar.gz 80.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for philler 0.1.0
File Interpreter ABI Platform
philler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 158.0 kB

Release files / philler-0.1.0.tar.gz

Download URL philler-0.1.0.tar.gz
Size 80.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c29c3747d23da6d9c720373a31e9aa1bc9d0ff2bb4b937aed86b51a868fc6ebe
BLAKE2b-256 checksum
How to use checksums
0cfc422fb265d266032b59b16e017e6e4a3d162e192599ee295e76f545c40f84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / philler-0.1.0-py3-none-any.whl

Download URL philler-0.1.0-py3-none-any.whl
Size 77.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
405b421abe0b223f3a1d6bd3198ff138bd453b988e943e836eb6d050929182a3
BLAKE2b-256 checksum
How to use checksums
6b81213a6178628e6c973690764526506cfdee1d9a060300e4bd5c6e8ac6e53e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for philler 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for philler-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page