Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.0.3 #10

Merged
merged 4 commits into from
May 28, 2024
Merged
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.2
current_version = 0.0.3
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>\w+)\.(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}.{build}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# mercury-robust

[![](https://github.com/BBVA/mercury-robust/actions/workflows/test.yml/badge.svg)](https://github.com/BBVA/mercury-robust)
![](https://img.shields.io/badge/latest-0.0.2-blue)
![](https://img.shields.io/badge/latest-0.0.3-blue)

## Mercury project at BBVA

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# mercury-robust

[![](https://github.com/BBVA/mercury-robust/actions/workflows/test.yml/badge.svg)](https://github.com/BBVA/mercury-robust)
![](https://img.shields.io/badge/latest-0.0.2-blue)
![](https://img.shields.io/badge/latest-3-blue)

***mercury-robust*** is a library to perform robust testing on models and/or datasets.

Expand Down
2 changes: 1 addition & 1 deletion mercury/robust/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
Top-level package for mercury robust.
"""

__version__ = '0.0.2'
__version__ = '0.0.3'

from .suite import TestSuite # noqa: 402
9 changes: 8 additions & 1 deletion mercury/robust/data_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ def run(self, *args, **kwargs):
)

if lin_combinations is not None:
raise FailedTestError("Test failed. Linear combinations for continuous features were encountered.")
# Create message with the linear combinations found
lin_combinations = np.around(lin_combinations, decimals=5)
lin_combs_found = []
for i in range(lin_combinations.shape[0]):
lin_comb_idx = np.where(lin_combinations[i] != 0)[0]
lin_comb_cols = self.base_dataset.loc[:, numeric_feats].columns[lin_comb_idx].tolist()
lin_combs_found.append(lin_comb_cols)
raise FailedTestError(f"Test failed. Linear combinations for continuous features were encountered: {lin_combs_found}.")

individually_redundant = CategoryStruct.individually_redundant(self.base_dataset, current_schema.categorical_feats)
if len(individually_redundant) > 0:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "mercury-robust"
license = {file = "LICENSE.txt"}
version = "0.0.2"
version = "0.0.3"
authors = [
{ name="Mercury Team", email="[email protected]" },
]
Expand Down
16 changes: 16 additions & 0 deletions tests/test_data_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,4 +857,20 @@ def test_no_duplicated_test():
with pytest.raises(FailedTestError):
test.run()

def test_lin_combinations_cont():

df = pd.DataFrame()
df["f1"] = np.random.uniform(size=100)
df["f2"] = df["f1"] * 2
df["f3"] = np.random.uniform(size=100)
df["f4"] = df["f1"] + df["f2"]
df["f5"] = np.random.uniform(size=100)

df["f6"] = np.random.uniform(size=100)
df["f7"] = df["f6"] * 3
df["f8"] = df["f6"] * 0.1

schma_reference = DataSchema().generate(df).calculate_statistics()
linear_comb_test = LinearCombinationsTest(df, dataset_schema=schma_reference)
with pytest.raises(FailedTestError, match="'f1', 'f2'"):
linear_comb_test.run()
Loading