Skip to content

Commit

Permalink
Fix missing feature_type in ColumnDriftMetric. (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liraim authored Aug 20, 2024
1 parent 8db8825 commit bb182aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"statsmodels>=0.12.2",
"scikit-learn>=1.0.1",
"pandas[parquet]>=1.3.5",
"numpy>=1.22.0",
"nltk>=3.6.7",
"numpy>=1.22.0,<2.1",
"nltk>=3.6.7,<=3.8.1",
"scipy>=1.10.0",
"requests>=2.32.0",
"PyYAML>=5.4",
Expand Down
4 changes: 2 additions & 2 deletions src/evidently/metrics/data_drift/column_drift_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ def calculate(self, data: InputData) -> ColumnDataDriftMetrics:
if self.column_name.is_main_dataset():
column_type = data.data_definition.get_column(self.column_name.name).column_type
else:
if self.column_name._feature_class is not None:
column_type = self.column_name._feature_class.feature_type
if self.column_name.feature_class is not None:
column_type = self.column_name.feature_class.get_type(self.column_name.name)

datetime_column = data.data_definition.get_datetime_column()
options = DataDriftOptions(all_features_stattest=self.stattest, threshold=self.stattest_threshold)
Expand Down
15 changes: 13 additions & 2 deletions tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ def test_minimal_requirements():
path = Path(__file__).parent.parent
with open(path / "requirements.min.txt") as f:
lines = {line.strip().split("#")[0] for line in f.readlines()}
min_reqs = {k.split("[")[0]: v for line in lines if line.strip() for k, v in (line.strip().split("=="),)}
min_reqs = {
k.split("[")[0]: _get_min_version(v)
for line in lines
if line.strip()
for k, v in (line.strip().split("=="),)
}

install_reqs = {k.split("[")[0]: v for r in setup_args["install_requires"] for k, v in (r.split(">="),)}
install_reqs = {
k.split("[")[0]: _get_min_version(v) for r in setup_args["install_requires"] for k, v in (r.split(">="),)
}
extra = []
wrong_version = []
for m, v in install_reqs.items():
Expand All @@ -23,3 +30,7 @@ def test_minimal_requirements():
assert (
len(extra) == 0 and len(wrong_version) == 0
), f"install_requires has extra reqs {extra} and wrong versions of {wrong_version}"


def _get_min_version(value):
return value.split(",")[0]

0 comments on commit bb182aa

Please sign in to comment.