Skip to content
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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "ValidMind Library"
license = "Commercial License"
name = "validmind"
readme = "README.pypi.md"
version = "2.9.0"
version = "2.9.1"

[tool.poetry.dependencies]
aiohttp = {extras = ["speedups"], version = "*"}
Expand Down
31 changes: 24 additions & 7 deletions tests/unit_tests/data_validation/test_ADF.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@

class TestADF(unittest.TestCase):
def setUp(self):
# Create a simple time series dataset
dates = pd.date_range(start="2023-01-01", periods=100, freq="D")
# Set random seed for reproducible results
np.random.seed(42)

# Create a simple time series dataset with larger size for more stable results
dates = pd.date_range(start="2023-01-01", periods=200, freq="D")

# Create more clearly stationary vs non-stationary series
self.df = pd.DataFrame(
{
"stationary": np.random.normal(0, 1, 100), # Stationary series
"stationary": np.random.normal(0, 1, 200), # Stationary series
"non_stationary": np.cumsum(
np.random.normal(0, 1, 100)
np.random.normal(0, 1, 200)
), # Random walk (non-stationary)
"with_nans": np.random.normal(0, 1, 100), # Series with NaN values
"with_nans": np.random.normal(0, 1, 200), # Series with NaN values
},
index=dates,
)
Expand Down Expand Up @@ -65,8 +70,20 @@ def test_stationary_vs_nonstationary(self):
stationary_result = table[table["Feature"] == "stationary"].iloc[0]
nonstationary_result = table[table["Feature"] == "non_stationary"].iloc[0]

# Stationary series should have lower p-value than non-stationary
self.assertLess(stationary_result["P-Value"], nonstationary_result["P-Value"])
# Instead of comparing p-values directly (which can be flaky),
# check that the ADF statistic for stationary series is more negative
# (indicating stronger evidence of stationarity)
self.assertLess(
stationary_result["ADF Statistic"],
nonstationary_result["ADF Statistic"],
"Stationary series should have a more negative ADF statistic than non-stationary series",
)

# Also check that both p-values are reasonable (between 0 and 1)
self.assertGreaterEqual(stationary_result["P-Value"], 0)
self.assertLessEqual(stationary_result["P-Value"], 1)
self.assertGreaterEqual(nonstationary_result["P-Value"], 0)
self.assertLessEqual(nonstationary_result["P-Value"], 1)

def test_raises_error_for_non_datetime_index(self):
# Create dataset with non-datetime index
Expand Down
2 changes: 1 addition & 1 deletion validmind/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.9.0"
__version__ = "2.9.1"
10 changes: 10 additions & 0 deletions validmind/tests/__types__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@
"validmind.unit_metrics.classification.Precision",
"validmind.unit_metrics.classification.ROC_AUC",
"validmind.unit_metrics.classification.Recall",
"validmind.unit_metrics.classification.individual.AbsoluteError",
"validmind.unit_metrics.classification.individual.BrierScore",
"validmind.unit_metrics.classification.individual.CalibrationError",
"validmind.unit_metrics.classification.individual.ClassBalance",
"validmind.unit_metrics.classification.individual.Confidence",
"validmind.unit_metrics.classification.individual.Correctness",
"validmind.unit_metrics.classification.individual.LogLoss",
"validmind.unit_metrics.classification.individual.OutlierScore",
"validmind.unit_metrics.classification.individual.ProbabilityError",
"validmind.unit_metrics.classification.individual.Uncertainty",
"validmind.unit_metrics.regression.AdjustedRSquaredScore",
"validmind.unit_metrics.regression.GiniCoefficient",
"validmind.unit_metrics.regression.HuberLoss",
Expand Down
3 changes: 2 additions & 1 deletion validmind/tests/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ def process_output(item: Any, result: TestResult) -> None:
"""Process a single test output item and update the TestResult."""
handlers = [
BooleanOutputHandler(),
MetricOutputHandler(),
FigureOutputHandler(),
TableOutputHandler(),
RawDataOutputHandler(),
StringOutputHandler(),
# Unit metrics should be processed last
MetricOutputHandler(),
]

for handler in handlers:
Expand Down