Skip to content

Commit

Permalink
Fix overlap of titles in drift plots (#462)
Browse files Browse the repository at this point in the history
* remove duplicate titles on graph

* remove comented out code
  • Loading branch information
benisraeldan committed Jan 4, 2022
1 parent f3dd910 commit 63af15f
Show file tree
Hide file tree
Showing 6 changed files with 425 additions and 471 deletions.
2 changes: 1 addition & 1 deletion deepchecks/base/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def wrap_run(func, class_instance):
def wrapped(*args, **kwargs):
result = func(*args, **kwargs)
if not isinstance(result, CheckResult):
raise DeepchecksValueError(f'Check {class_instance.name()} expected to return CheckResult bot got: '
raise DeepchecksValueError(f'Check {class_instance.name()} expected to return CheckResult but got: '
+ type(result).__name__)
result.check = class_instance
result.process_conditions()
Expand Down
5 changes: 2 additions & 3 deletions deepchecks/checks/distribution/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def calc_drift_and_plot(train_column: pd.Series, test_column: pd.Series, plot_ti
expected_percents, actual_percents, _ = \
preprocess_2_cat_cols_to_same_bins(dist1=train_dist, dist2=test_dist, max_num_categories=max_num_categories)
score = psi(expected_percents=expected_percents, actual_percents=actual_percents)
bar_stop = max(0.4, score + 0.1)
bar_stop = min(max(0.4, score + 0.1), 1)

score_bar = drift_score_bar_traces(score)

Expand All @@ -157,8 +157,7 @@ def calc_drift_and_plot(train_column: pd.Series, test_column: pd.Series, plot_ti
gridcolor='black',
linecolor='black',
range=[0, bar_stop],
dtick=0.05,
title='drift score'
dtick=0.05
),
yaxis=dict(
showgrid=False,
Expand Down
5 changes: 2 additions & 3 deletions deepchecks/checks/distribution/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,13 @@ def feature_distribution_traces(train_column,
Args:
train_column (): Train data used to trace distribution.
test_column (): Test data used to trace distribution.
plot_title (str): Name of the plot.
is_categorical (bool): State if column is categorical (default: False).
max_num_categories (int): Maximum number of categories to show in plot (default: 10).
Returns:
List[Union[go.Bar, go.Scatter]]: list of plotly traces.
Dict: layout of x axis
Dicst: layout of y axis
Dict: layout of y axis
"""
if is_categorical:
expected_percents, actual_percents, categories_list = \
Expand Down Expand Up @@ -142,7 +141,7 @@ def feature_distribution_traces(train_column,

traces = [train_bar, test_bar]

xaxis_layout = dict(title='Distribution', type='category')
xaxis_layout = dict(type='category')
yaxis_layout = dict(fixedrange=True,
range=(0, 1),
title='Percentage')
Expand Down

0 comments on commit 63af15f

Please sign in to comment.