Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ Evidently is very modular. You can start with one-off evaluations or host a full
* Best for experiments, exploratory analysis and debugging.
* View interactive Reports in Python or export as JSON, Python dictionary, HTML, or view in monitoring UI.

Turn any Report into a **Test Suite** by adding pass/fail conditions.
Turn any Report into a **Test Suite** by adding pass/fail conditions to automatically validate data quality, model performance, or drift over time.

* Best for regression testing, CI/CD checks, or data validation.
* Zero setup option: auto-generate test conditions from the reference dataset.
* Simple syntax to set test conditions as `gt` (greater than), `lt` (less than), etc.

| Reports |
|--|
|![Report example](https://github.com/evidentlyai/docs/blob/eb1630cdd80d31d55921ff4d34fc7b5e6e9c9f90/images/concepts/report_test_preview.gif)|
|![Report Turn any Report into a **Test Suite** by adding pass/fail conditions to automatically validate data quality, model performance, or drift over time.
example](https://github.com/evidentlyai/docs/blob/eb1630cdd80d31d55921ff4d34fc7b5e6e9c9f90/images/concepts/report_test_preview.gif)|

## 2. Monitoring Dashboard

Expand Down
21 changes: 21 additions & 0 deletions src/dashboard/widgets/feature_correlation_widget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import plotly.express as px
import pandas as pd

def plot_correlation_heatmap(correlations):
"""
Plots feature correlations as a heatmap using Plotly
correlations: pandas Series with feature names as index
"""
# Convert Series to DataFrame: 1 row (target) x n columns (features)
df = pd.DataFrame([correlations.values], columns=correlations.index, index=[correlations.name if correlations.name else "target"])

fig = px.imshow(
df,
text_auto=True, # shows values on the heatmap
color_continuous_scale='Viridis',
labels={'x': 'Features', 'y': 'Target', 'color': 'Correlation'}
)

fig.update_layout(title="Feature Correlation Heatmap")
return fig

50 changes: 50 additions & 0 deletions src/evidently/dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""
Dashboard for Evidently: Feature Correlation Heatmap Integration
Author: Your Name
Date: 2026-02-02
"""

# Imports
import pandas as pd
from src.metrics.feature_correlation import feature_correlation
from src.dashboard.widgets.feature_correlation_widget import plot_correlation_heatmap

# ----------------------------
# Widget Function
# ----------------------------
def add_feature_correlation_widget(df, target_col):
"""
Adds the Feature Correlation Heatmap to the dashboard.

Parameters:
- df: pandas DataFrame containing your dataset
- target_col: name of the target column to compute correlations against

Returns:
- fig: Plotly heatmap figure
"""
correlations = feature_correlation(df, target_col)
fig = plot_correlation_heatmap(correlations)
fig.show() # For testing; later integrate directly into the web dashboard
return fig

# ----------------------------
# Sample Test Dataset
# ----------------------------
if __name__ == "__main__":
# Sample dataset for testing the heatmap
df = pd.DataFrame({
"A": [1, 2, 3, 4, 5],
"B": [5, 4, 3, 2, 1],
"C": [2, 3, 2, 3, 2],
"target": [0, 1, 0, 1, 0]
})

target_col = "target"

# Add the feature correlation heatmap to the dashboard
add_feature_correlation_widget(df, target_col)

# TODO: Replace the sample dataset with real project dataset or user-uploaded CSV
# TODO: Embed the Plotly figure directly into the web dashboard layout

9 changes: 9 additions & 0 deletions src/metrics/feature_correlation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pandas as pd

def feature_correlation(df, target_col):
"""
Computes correlation of all features with the target column.
Returns a sorted pandas Series.
"""
correlations = df.corr()[target_col].sort_values(ascending=False)
return correlations
14 changes: 14 additions & 0 deletions test_heatmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pandas as pd
from src.metrics.feature_correlation import feature_correlation
from src.dashboard.widgets.feature_correlation_widget import plot_correlation_heatmap

# Sample data
df = pd.DataFrame({
"A": [1, 2, 3, 4],
"B": [2, 4, 6, 8],
"target": [1, 0, 1, 0]
})

correlations = feature_correlation(df, "target")
fig = plot_correlation_heatmap(correlations)
fig.show()
Loading