Skip to content

Commit

Permalink
DiffCorrMatrix fix error trying to call abs() on np.array (#117)
Browse files Browse the repository at this point in the history
* add kendall tau

* test ordinal and len in check_column_types, consider sr codes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* replace print with assignment

* reverse order of categories to make test more obvious

* apply fix for error when trying to call .abs() on np.array

* add test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tomcarter23 and pre-commit-ci[bot] authored Mar 29, 2023
1 parent d619081 commit 4ee4908
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/insight/metrics/metrics_usage.py
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ def summarize_result(self, result: pd.DataFrame):
Args:
result: the result of the metric computation.
"""
return result.values.abs().max()
return result.abs().max().max() # max().max() = max in each col -> max across cols

def __init__(self, metric: TwoColumnMetric):
self._corr_matrix = CorrMatrix(metric)
1 change: 1 addition & 0 deletions tests/test_metrics/test_metrics_usage.py
Original file line number Diff line number Diff line change
@@ -57,3 +57,4 @@ def test_metric_matrix(data):
assert all(np.isnan(diff[cont1][cont2]) and np.isnan(diff[cont2][cont1]) for cont1 in continuous_cols for cont2 in continuous_cols)
assert all(np.isnan(diff[cat][cont]) and np.isnan(diff[cont][cat]) for cat in categorical_cols for cont in continuous_cols)
assert all(not np.isnan(diff[cat1][cat2]) and not np.isnan(diff[cat2][cat1]) for cat1 in categorical_cols for cat2 in categorical_cols if cat1 != cat2)
assert not np.isnan(cmv_diff_mat.summarize_result(diff))

0 comments on commit 4ee4908

Please sign in to comment.