explainviz 1.0.0__tar.gz

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.
@@ -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,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,34 @@
1
+ # ExplainViz
2
+
3
+ ExplainViz is a Python 3.10+ visualization library that not only plots data,
4
+ but also explains what is happening inside the data using clear,
5
+ rule-based statistical insights.
6
+
7
+ It is designed to sit on top of Matplotlib and provide:
8
+ - Automatic plots
9
+ - Distribution explanations
10
+ - Stability and change detection
11
+ - Relationship analysis
12
+ - Group bias and fairness checks
13
+
14
+ ExplainViz focuses on **clarity, reliability, and real-world usability** —
15
+ no black-box AI, no hidden magic.
16
+
17
+ ---
18
+
19
+ ## ✨ Key Features
20
+
21
+ - šŸ“Š Automatic plot selection (numeric, grouped data)
22
+ - šŸ“ˆ Distribution analysis (skewness, tails)
23
+ - ⚔ Sudden change detection in data
24
+ - šŸ”— Strong relationship detection between variables
25
+ - āš–ļø Group bias and imbalance checks
26
+ - 🧠 Human-readable explanations alongside plots
27
+ - šŸ Python 3.10+ compatible
28
+
29
+ ---
30
+
31
+ ## šŸ“¦ Installation
32
+
33
+ ```bash
34
+ pip install explainviz
@@ -0,0 +1,13 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "explainviz"
7
+ version = "1.0.0"
8
+ description = "ExplainViz: Visualization that explains data behavior and bias"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{ name = "Pushkar Kaushalendra Sharma" }]
12
+ dependencies = ["pandas", "numpy", "matplotlib"]
13
+ requires-python = ">=3.10"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -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
+ ]
@@ -0,0 +1,3 @@
1
+ from .about import about
2
+
3
+ about()
@@ -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,10 @@
1
+ def detect_changes(series, threshold=2.5):
2
+ diffs = series.diff().abs()
3
+ std = series.std()
4
+
5
+ points = diffs[diffs > threshold * std].index.tolist()
6
+
7
+ return {
8
+ "count": len(points),
9
+ "indices": points[:5],
10
+ }
@@ -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
@@ -0,0 +1,11 @@
1
+ def analyze_relationships(df, target):
2
+ strong = {}
3
+
4
+ for col in df.select_dtypes("number"):
5
+ if col == target:
6
+ continue
7
+ corr = df[target].corr(df[col])
8
+ if corr and abs(corr) >= 0.6:
9
+ strong[col] = float(corr)
10
+
11
+ return strong
@@ -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,7 @@
1
+ """
2
+ Explanation and formatting utilities for ExplainViz.
3
+ """
4
+
5
+ from .formatter import format_explanations
6
+
7
+ __all__ = ["format_explanations"]
@@ -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,7 @@
1
+ """
2
+ Fairness and bias analysis modules for ExplainViz.
3
+ """
4
+
5
+ from .bias import check_bias
6
+
7
+ __all__ = ["check_bias"]
@@ -0,0 +1,9 @@
1
+ def check_bias(df, target, group):
2
+ means = df.groupby(group)[target].mean()
3
+ ratio = means.max() / means.min()
4
+
5
+ return {
6
+ "means": means.to_dict(),
7
+ "disparity_ratio": float(ratio),
8
+ "biased": ratio > 1.5,
9
+ }
@@ -0,0 +1,7 @@
1
+ """
2
+ Utility and validation helpers for ExplainViz.
3
+ """
4
+
5
+ from .validators import validate_inputs
6
+
7
+ __all__ = ["validate_inputs"]
@@ -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,24 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ src/explainviz/__init__.py
5
+ src/explainviz/__main__.py
6
+ src/explainviz/about.py
7
+ src/explainviz/explain.py
8
+ src/explainviz.egg-info/PKG-INFO
9
+ src/explainviz.egg-info/SOURCES.txt
10
+ src/explainviz.egg-info/dependency_links.txt
11
+ src/explainviz.egg-info/requires.txt
12
+ src/explainviz.egg-info/top_level.txt
13
+ src/explainviz/core/__init__.py
14
+ src/explainviz/core/auto_plotter.py
15
+ src/explainviz/core/changepoints.py
16
+ src/explainviz/core/distribution.py
17
+ src/explainviz/core/profiler.py
18
+ src/explainviz/core/relationships.py
19
+ src/explainviz/explainers/__init__.py
20
+ src/explainviz/explainers/formatter.py
21
+ src/explainviz/fairness/__init__.py
22
+ src/explainviz/fairness/bias.py
23
+ src/explainviz/utils/__init__.py
24
+ src/explainviz/utils/validators.py
@@ -0,0 +1,3 @@
1
+ pandas
2
+ numpy
3
+ matplotlib
@@ -0,0 +1 @@
1
+ explainviz