Metadata-Version: 2.4
Name: LM-hypotest
Version: 0.1.1
Summary: A Python library for hypothesis testing with automated assumptions
Author: Hypotest Contributors
License: MIT
Project-URL: Homepage, https://github.com/chikku1234568/Unified-EDA-HypoTest-LM-Library
Project-URL: Repository, https://github.com/chikku1234568/Unified-EDA-HypoTest-LM-Library
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.5
Requires-Dist: numpy>=1.21
Requires-Dist: scipy>=1.9
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Provides-Extra: llm
Requires-Dist: openai>=1.0; extra == "llm"
Requires-Dist: anthropic>=0.7; extra == "llm"
Dynamic: license-file

Hypotest

A Python library for deterministic hypothesis testing with automatic assumption checking and optional LLM-based interpretation.

Hypotest provides a clean statistical engine designed for data scientists, researchers, and engineers who need reliable and reproducible statistical testing workflows.

Overview

Hypotest simplifies hypothesis testing by providing:

A deterministic statistical engine

Automatic assumption validation (normality, variance homogeneity)

Structured result objects with statistical metadata

Optional LLM-based interpretation layer

A safe Dataset abstraction for robust data handling

All statistical computations are deterministic and independent of LLM usage.

Installation

Once published:

pip install hypotest


Development install:

git clone https://github.com/chikku1234568/Unified-EDA-HypoTest-LM-Library
cd hypotest
pip install -e .


Optional LLM support:

pip install hypotest[llm]

Quick Start
Example: Independent t-test
import pandas as pd
import numpy as np

import hypotest
from hypotest.core.dataset import Dataset
from hypotest.tests.parametric.ttest import TTest


# Create example dataset
df = pd.DataFrame({
    "group": ["A"] * 100 + ["B"] * 100,
    "value": np.concatenate([
        np.random.normal(0, 1, 100),
        np.random.normal(1, 1, 100),
    ])
})

# Wrap DataFrame in Dataset abstraction
dataset = Dataset(df)

# Run t-test
test = TTest()

result = test.execute(
    dataset=dataset,
    target="value",
    features=["group"],
)

print(result)


Output:

TestResult(test='Independent t-test', feature='group', statistic=4.231, p=0.00003, significant)

Automatic Assumption Checking

Hypotest automatically checks statistical assumptions before or during test execution.

for assumption in result.assumptions:
    print(assumption.assumption_name, assumption.passed)


Example output:

normality True
homoscedasticity False


Each assumption provides:

statistical result

interpretation

recommendation

Optional LLM Interpretation

Hypotest can generate natural-language explanations using any OpenAI-compatible provider.

Example using DeepSeek:

hypotest.configure(
    llm_api_key="your-api-key",
    llm_base_url="https://api.deepseek.com/v1",
    llm_model="deepseek-chat",
    enable_llm_interpretation=True,
)

print(result.explain())


Example output:

The independent t-test indicates a statistically significant difference between the two groups...


LLM interpretation is optional and does not affect statistical computation.

Configuration

Configure hypotest globally:

hypotest.configure(
    llm_api_key="your-key",
    llm_base_url="https://api.deepseek.com/v1",
    llm_model="deepseek-chat",
    enable_llm_interpretation=True,
)


View configuration:

print(hypotest.info())

Dataset Abstraction

Hypotest uses a Dataset wrapper to provide safe data handling:

from hypotest.core.dataset import Dataset

dataset = Dataset(df)


This enables:

safe missing value handling

validation before test execution

future extensibility

Supported Tests (Current MVP)

Independent t-test

Planned:

Welch's t-test

Mann-Whitney U test

ANOVA

Chi-square test

Correlation tests

Features

Core features implemented:

Deterministic statistical engine

Automatic assumption checking

Structured TestResult objects

Dataset abstraction layer

Plug-in test registry system

Optional LLM interpretation

Planned features:

Automatic test recommendation

Effect size library

Automated reporting

Additional statistical tests

Example: Full Workflow
import pandas as pd
import numpy as np
import hypotest

from hypotest.core.dataset import Dataset
from hypotest.tests.parametric.ttest import TTest


hypotest.configure(enable_llm_interpretation=False)

df = pd.DataFrame({
    "group": ["A"] * 50 + ["B"] * 50,
    "value": np.random.randn(100),
})

dataset = Dataset(df)

test = TTest()

result = test.execute(dataset, "value", ["group"])

print(result)

for a in result.assumptions:
    print(a.assumption_name, a.passed)

print(result.explain())  # None if LLM disabled

Project Structure
hypotest/
├── core/
│   ├── dataset.py
│   ├── result.py
│
├── tests/
│   ├── parametric/
│       ├── ttest.py
│
├── assumptions/
│   ├── normality.py
│   ├── variance.py
│
├── llm/
│   ├── client.py
│   ├── interpreter.py
│
├── config/
│   ├── manager.py
│
├── info.py

Requirements

Python ≥ 3.10

pandas ≥ 1.5

numpy ≥ 1.21

scipy ≥ 1.9

Optional:

openai-compatible client (for LLM interpretation)

Philosophy

Hypotest separates:

Deterministic statistical computation

Probabilistic natural-language interpretation

This ensures statistical correctness while enabling explainability.

License

MIT License
