A powerful tool for analyzing leading indicators and setting optimal thresholds
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leadindicator-0.1.1.tar.gz.
File metadata
- Download URL: leadindicator-0.1.1.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dedd50adf3fc036227b5a2fc519f94b5f4d2a388c0fe97aa9341b6af1b12493
|
|
| MD5 |
b4a38cb37ccbdfaff14bba1293512097
|
|
| BLAKE2b-256 |
2d18ac278704b084f0754f44400861667193c95d5322070bfe8f6f16c21f13c3
|
File details
Details for the file leadindicator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: leadindicator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f32ceeb2ba53806509e3db9e9305f85af5b3f6aa3ff7b50aa21758589c76c06
|
|
| MD5 |
572c172ee374cfc18d17064265c5c991
|
|
| BLAKE2b-256 |
47b1cfaead27b854c2554cb91d85c5d70969989514e29c5a6fc91a76bd5df2d5
|