explainviz 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- explainviz/__init__.py +30 -0
- explainviz/__main__.py +3 -0
- explainviz/about.py +13 -0
- explainviz/core/__init__.py +17 -0
- explainviz/core/auto_plotter.py +21 -0
- explainviz/core/changepoints.py +10 -0
- explainviz/core/distribution.py +18 -0
- explainviz/core/profiler.py +18 -0
- explainviz/core/relationships.py +11 -0
- explainviz/explain.py +23 -0
- explainviz/explainers/__init__.py +7 -0
- explainviz/explainers/formatter.py +22 -0
- explainviz/fairness/__init__.py +7 -0
- explainviz/fairness/bias.py +9 -0
- explainviz/utils/__init__.py +7 -0
- explainviz/utils/validators.py +15 -0
- explainviz-1.0.0.dist-info/METADATA +48 -0
- explainviz-1.0.0.dist-info/RECORD +21 -0
- explainviz-1.0.0.dist-info/WHEEL +5 -0
- explainviz-1.0.0.dist-info/licenses/LICENSE.txt +24 -0
- explainviz-1.0.0.dist-info/top_level.txt +1 -0
explainviz/__init__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__author__ = "Pushkar Kaushalendra Sharma"
|
|
2
|
+
__version__ = "1.0.0"
|
|
3
|
+
__license__ = "MIT"
|
|
4
|
+
|
|
5
|
+
__about__ = (
|
|
6
|
+
"ExplainViz is a Python 3.10+ visualization library that not only plots data "
|
|
7
|
+
"but also explains distribution, stability, relationships, and potential bias "
|
|
8
|
+
"using rule-based statistical analysis."
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
from .explain import explain
|
|
12
|
+
from .about import about
|
|
13
|
+
|
|
14
|
+
from .core.profiler import profile
|
|
15
|
+
from .core.distribution import analyze_distribution
|
|
16
|
+
from .core.changepoints import detect_changes
|
|
17
|
+
from .core.relationships import analyze_relationships
|
|
18
|
+
from .core.auto_plotter import auto_plot
|
|
19
|
+
from .fairness.bias import check_bias
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"explain",
|
|
23
|
+
"about",
|
|
24
|
+
"profile",
|
|
25
|
+
"analyze_distribution",
|
|
26
|
+
"detect_changes",
|
|
27
|
+
"analyze_relationships",
|
|
28
|
+
"auto_plot",
|
|
29
|
+
"check_bias",
|
|
30
|
+
]
|
explainviz/__main__.py
ADDED
explainviz/about.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
def about():
|
|
2
|
+
print(
|
|
3
|
+
"""
|
|
4
|
+
ExplainViz v1.0.0
|
|
5
|
+
-----------------
|
|
6
|
+
Author : Pushkar Kaushalendra Sharma
|
|
7
|
+
License : MIT
|
|
8
|
+
Python : 3.10+
|
|
9
|
+
|
|
10
|
+
ExplainViz is a visualization-first analytics library that
|
|
11
|
+
automatically explains data behavior alongside plots.
|
|
12
|
+
""".strip()
|
|
13
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core analytical modules for ExplainViz.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .profiler import profile
|
|
6
|
+
from .distribution import analyze_distribution
|
|
7
|
+
from .changepoints import detect_changes
|
|
8
|
+
from .relationships import analyze_relationships
|
|
9
|
+
from .auto_plotter import auto_plot
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"profile",
|
|
13
|
+
"analyze_distribution",
|
|
14
|
+
"detect_changes",
|
|
15
|
+
"analyze_relationships",
|
|
16
|
+
"auto_plot",
|
|
17
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import matplotlib.pyplot as plt
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def auto_plot(df, target, group, stats, changes):
|
|
5
|
+
fig, ax = plt.subplots()
|
|
6
|
+
|
|
7
|
+
if group:
|
|
8
|
+
df.groupby(group)[target].mean().plot(kind="bar", ax=ax)
|
|
9
|
+
else:
|
|
10
|
+
df[target].plot(ax=ax)
|
|
11
|
+
|
|
12
|
+
ax.axhline(stats["mean"], linestyle="--", label="Mean")
|
|
13
|
+
|
|
14
|
+
for i in changes["indices"]:
|
|
15
|
+
ax.axvline(i, alpha=0.3)
|
|
16
|
+
|
|
17
|
+
ax.legend()
|
|
18
|
+
plt.tight_layout()
|
|
19
|
+
plt.show()
|
|
20
|
+
|
|
21
|
+
return fig
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
def analyze_distribution(series):
|
|
2
|
+
skew = series.skew()
|
|
3
|
+
kurt = series.kurtosis()
|
|
4
|
+
|
|
5
|
+
shape = (
|
|
6
|
+
"Right-skewed" if skew > 0.5 else
|
|
7
|
+
"Left-skewed" if skew < -0.5 else
|
|
8
|
+
"Symmetric"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
tail = "Heavy-tailed" if kurt > 3 else "Normal-tailed"
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
"skewness": float(skew),
|
|
15
|
+
"kurtosis": float(kurt),
|
|
16
|
+
"shape": shape,
|
|
17
|
+
"tail": tail,
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
def profile(df, target, group=None):
|
|
2
|
+
s = df[target]
|
|
3
|
+
|
|
4
|
+
stats = {
|
|
5
|
+
"count": int(s.count()),
|
|
6
|
+
"missing_pct": float(s.isna().mean() * 100),
|
|
7
|
+
"mean": float(s.mean()),
|
|
8
|
+
"median": float(s.median()),
|
|
9
|
+
"std": float(s.std()),
|
|
10
|
+
"min": float(s.min()),
|
|
11
|
+
"max": float(s.max()),
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if group:
|
|
15
|
+
sizes = df.groupby(group)[target].count()
|
|
16
|
+
stats["imbalance_ratio"] = float(sizes.max() / sizes.min())
|
|
17
|
+
|
|
18
|
+
return stats
|
explainviz/explain.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from .utils.validators import validate_inputs
|
|
2
|
+
from .core.profiler import profile
|
|
3
|
+
from .core.distribution import analyze_distribution
|
|
4
|
+
from .core.changepoints import detect_changes
|
|
5
|
+
from .core.relationships import analyze_relationships
|
|
6
|
+
from .fairness.bias import check_bias
|
|
7
|
+
from .core.auto_plotter import auto_plot
|
|
8
|
+
from .explainers.formatter import format_explanations
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def explain(df, *, target, group=None):
|
|
12
|
+
validate_inputs(df, target, group)
|
|
13
|
+
|
|
14
|
+
stats = profile(df, target, group)
|
|
15
|
+
dist = analyze_distribution(df[target])
|
|
16
|
+
changes = detect_changes(df[target])
|
|
17
|
+
relations = analyze_relationships(df, target)
|
|
18
|
+
bias = check_bias(df, target, group) if group else None
|
|
19
|
+
|
|
20
|
+
fig = auto_plot(df, target, group, stats, changes)
|
|
21
|
+
print(format_explanations(stats, dist, changes, relations, bias))
|
|
22
|
+
|
|
23
|
+
return fig
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
def format_explanations(stats, distribution, changes, relations, bias):
|
|
2
|
+
lines = ["📊 ExplainViz Analysis\n"]
|
|
3
|
+
|
|
4
|
+
lines.append("▶ Summary")
|
|
5
|
+
lines.append(f"• Mean: {stats['mean']:.2f}, Median: {stats['median']:.2f}")
|
|
6
|
+
|
|
7
|
+
lines.append("\n▶ Distribution")
|
|
8
|
+
lines.append(f"• {distribution['shape']} | {distribution['tail']}")
|
|
9
|
+
|
|
10
|
+
lines.append("\n▶ Stability")
|
|
11
|
+
lines.append(f"• Sudden changes: {changes['count']}")
|
|
12
|
+
|
|
13
|
+
if relations:
|
|
14
|
+
lines.append("\n▶ Relationships")
|
|
15
|
+
for k, v in relations.items():
|
|
16
|
+
lines.append(f"• {k}: {v:.2f}")
|
|
17
|
+
|
|
18
|
+
if bias:
|
|
19
|
+
lines.append("\n▶ Fairness")
|
|
20
|
+
lines.append(f"• Disparity ratio: {bias['disparity_ratio']:.2f}")
|
|
21
|
+
|
|
22
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def validate_inputs(df, target, group):
|
|
5
|
+
if not isinstance(df, pd.DataFrame):
|
|
6
|
+
raise TypeError("df must be a pandas DataFrame")
|
|
7
|
+
|
|
8
|
+
if target not in df.columns:
|
|
9
|
+
raise ValueError(f"Target column '{target}' not found")
|
|
10
|
+
|
|
11
|
+
if group and group not in df.columns:
|
|
12
|
+
raise ValueError(f"Group column '{group}' not found")
|
|
13
|
+
|
|
14
|
+
if df[target].dropna().empty:
|
|
15
|
+
raise ValueError("Target column has no usable values")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: explainviz
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ExplainViz: Visualization that explains data behavior and bias
|
|
5
|
+
Author: Pushkar Kaushalendra Sharma
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Requires-Dist: pandas
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# ExplainViz
|
|
16
|
+
|
|
17
|
+
ExplainViz is a Python 3.10+ visualization library that not only plots data,
|
|
18
|
+
but also explains what is happening inside the data using clear,
|
|
19
|
+
rule-based statistical insights.
|
|
20
|
+
|
|
21
|
+
It is designed to sit on top of Matplotlib and provide:
|
|
22
|
+
- Automatic plots
|
|
23
|
+
- Distribution explanations
|
|
24
|
+
- Stability and change detection
|
|
25
|
+
- Relationship analysis
|
|
26
|
+
- Group bias and fairness checks
|
|
27
|
+
|
|
28
|
+
ExplainViz focuses on **clarity, reliability, and real-world usability** —
|
|
29
|
+
no black-box AI, no hidden magic.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ✨ Key Features
|
|
34
|
+
|
|
35
|
+
- 📊 Automatic plot selection (numeric, grouped data)
|
|
36
|
+
- 📈 Distribution analysis (skewness, tails)
|
|
37
|
+
- ⚡ Sudden change detection in data
|
|
38
|
+
- 🔗 Strong relationship detection between variables
|
|
39
|
+
- ⚖️ Group bias and imbalance checks
|
|
40
|
+
- 🧠 Human-readable explanations alongside plots
|
|
41
|
+
- 🐍 Python 3.10+ compatible
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📦 Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install explainviz
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
explainviz/__init__.py,sha256=HFdA9_QfwUPYMXFzTsXruKXUzyAX9-fyyfHLtTsnS3E,838
|
|
2
|
+
explainviz/__main__.py,sha256=HmdqchkdvqgbZpsEJ88ahzj9Zvy1aJ7-HhwLqSbRzhI,37
|
|
3
|
+
explainviz/about.py,sha256=KtoRFyfDf_NfGzf2E197gHYvZJAfwmxKFyYvCbzZT8I,293
|
|
4
|
+
explainviz/explain.py,sha256=srkKMWS_8knIBWN-N3t5TlSBF_iFUrMBcYXOpQvpZa8,847
|
|
5
|
+
explainviz/core/__init__.py,sha256=q3blkuKeGm51FG7IfCsPH70xZV9LVH_xmHrEa-Y-z80,395
|
|
6
|
+
explainviz/core/auto_plotter.py,sha256=AO9c_8aibAqj9NwQYhiYtPUe9UCEtR4Awh7QYTrZ4qE,454
|
|
7
|
+
explainviz/core/changepoints.py,sha256=3UVWFbzIsc_KE9uRAkORneUP5qh1pk97VLz6K89wY6c,249
|
|
8
|
+
explainviz/core/distribution.py,sha256=AlXumejEgqN0TPt0avS9UPGCa_LpNffkxGYw_Mdo2Zc,423
|
|
9
|
+
explainviz/core/profiler.py,sha256=j0BNa3bNDheYUlyYvWhAjjAYJUfOfa6g_UZE_yQXALw,495
|
|
10
|
+
explainviz/core/relationships.py,sha256=NE1myug-4vOiy3k4Tdv4jEjTAZcz1id55YithpI3jwI,292
|
|
11
|
+
explainviz/explainers/__init__.py,sha256=sYmD26LEV6MeAPibW2ATcksa8QQl2v8AnD5ljQg1Ccc,147
|
|
12
|
+
explainviz/explainers/formatter.py,sha256=b9Nd_5ZMOz3fdRAqSATl9h3VbreBP2dlbVjgKw8YqrQ,769
|
|
13
|
+
explainviz/fairness/__init__.py,sha256=wGZD7euJHu3rY6WmOVT-RLDLHQjWDfA59OBMcqrDsIE,122
|
|
14
|
+
explainviz/fairness/bias.py,sha256=FNXBrBJ-CqTRRRZSfauaXdu7BogoxM4XdvNVJ04F3Ss,253
|
|
15
|
+
explainviz/utils/__init__.py,sha256=hgWKC-NutcjP7vW1jPiogGqpjDLW0Iy0jG741bjoWPw,134
|
|
16
|
+
explainviz/utils/validators.py,sha256=KVARKPJpBGtFxnPyOU6HY-Qc83Msm9-RMba65xvJYs8,476
|
|
17
|
+
explainviz-1.0.0.dist-info/licenses/LICENSE.txt,sha256=VnFjhFGqkC33Nm6EmAnWL0VTc9A1Q76E1y8OguGby1I,1230
|
|
18
|
+
explainviz-1.0.0.dist-info/METADATA,sha256=3zCcxy_pbXQqk9L-NO52eGlIVDuyoso8DG_1byVZj-E,1304
|
|
19
|
+
explainviz-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
20
|
+
explainviz-1.0.0.dist-info/top_level.txt,sha256=CiE1TkaKU_az8yTz8AJglQr9B27hBo17gx06F5He0ck,11
|
|
21
|
+
explainviz-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pushkar Kaushalendra Sharma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
1. The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
2. Any modifications or derivative works must clearly indicate that changes
|
|
16
|
+
were made to the original software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
explainviz
|