Skip to main content

LeadIndicator

A Python package for analyzing leading indicators and finding optimal thresholds.

Features

  • Analyze time series data to identify leading indicators
  • Find optimal thresholds using multiple metrics
  • Generate comprehensive analysis reports
  • Support for categorical analysis
  • Beautiful visualizations
  • Polars-based for high performance

Installation

pip install leadindicator

Quick Start

import polars as pl
from leadindicator import ThresholdAnalyzer

# Load your data
df = pl.read_excel("your_data.xlsx")

# Create analyzer
analyzer = ThresholdAnalyzer(
    score_column="score",
    target_column="event",
    category_column="category"  # Optional
)

# Run analysis
results = analyzer.analyze(df)

# Generate report
analyzer.save_report("analysis_report.html")

Example: Fruit Spoilage Analysis

The package includes an example that demonstrates how to use LeadIndicator to analyze fruit spoilage data:

from leadindicator import ThresholdAnalyzer
import polars as pl

# Load example data
df = pl.read_excel("Test Data.xlsx")

# Create analyzer
analyzer = ThresholdAnalyzer(
    score_column="Ethylene",
    target_column="Spoiled",
    category_column="Fruit Type"
)

# Run analysis
results = analyzer.analyze(df)

# Save report
analyzer.save_report("fruit_spoilage_analysis.html")

# Access results programmatically
best_threshold = results[0]
print(f"Best threshold: {best_threshold.threshold}")
print(f"Balanced accuracy: {best_threshold.balanced_accuracy:.2%}")
print(f"Capture rate: {best_threshold.capture_rate:.1f}%")
print(f"Event probability: {best_threshold.event_probability:.1f}%")

Documentation

For detailed documentation, visit docs/.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for leadindicator 0.1.1

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

Source distribution (sdist)

Source distribution for leadindicator 0.1.1
File Size Uploaded Provenance Actions
leadindicator-0.1.1.tar.gz 32.2 kB Without provenance Details for leadindicator-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 46.1 kB

Release files / leadindicator-0.1.1.tar.gz

Download URL leadindicator-0.1.1.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4dedd50adf3fc036227b5a2fc519f94b5f4d2a388c0fe97aa9341b6af1b12493
BLAKE2b-256 checksum
How to use checksums
2d18ac278704b084f0754f44400861667193c95d5322070bfe8f6f16c21f13c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / leadindicator-0.1.1-py3-none-any.whl

Download URL leadindicator-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f32ceeb2ba53806509e3db9e9305f85af5b3f6aa3ff7b50aa21758589c76c06
BLAKE2b-256 checksum
How to use checksums
47b1cfaead27b854c2554cb91d85c5d70969989514e29c5a6fc91a76bd5df2d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Security for leadindicator 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No 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