ml4t-validate-data
/ml4t-validate-data
Systematic data quality validation before modeling. Use when checking for gaps, outliers, stale prices, or schema violations in datasets.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 23.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
Systematic data quality validation before modeling. Use when checking for gaps, outliers, stale prices, or schema violations in datasets.
Original author description
Systematic data quality validation before modeling. Use when checking for gaps, outliers, stale prices, or schema violations in datasets.
How it works
- The Problem
- The Pattern
- Corporate Action Detection
- Guardrails
- Production Implementation
- Checklist
SKILL.md preview
---
name: ml4t-validate-data
description: "Systematic data quality validation before modeling. Use when checking for gaps, outliers, stale prices, or schema violations in datasets."
when_to_use: "Use when ingesting new data or before any model training run"
dependencies: [fetch-data]
metadata:
book_chapters: "2, 3"
library: "ml4t-data"
paths: ["**/*data*.py", "**/*fetch*.py", "**/*bars*.py", "**/*universe*.py", "**/*calendar*.py", "**/*futures*.py", "**/*export*.py", "**/*synthetic*.py"]
---
# Validate Data
Unvalidated data silently corrupts models - a single unadjusted stock split can make a momentum signal look 10x stronger than reality.
## The Problem
Financial data arrives with missing values, duplicate timestamps, unadjusted corporate actions, stale prices, and impossible OHLC relationships. Using raw data without checks means your model trains on artifacts. A 50% overnight return that is actually a 2:1 split will dominate any feature that touches price changes. You will not see this in your loss function - the model happily fits the noise.
## The Pattern
### WRONG
```python
import polars as pl
# Trust the data, start modeling immediately
df = pl.read_parquet("prices.parquet")
features = df.with_columns(ret=pl.col("close").pct_change())
model.fit(features) # Trained on splits, gaps, duplicates
```
### CORRECT
```python
import polars as pl
def validate_ohlcv(df: pl.DataFrame) -> dict[str, int]:
"""Run standard OHLCV quality checks. Returns issue counts."""
issues = {}
# OHLC consistency: high >= low, close within [low, high]
issues["high_lt_low"] = df.filter(pl.col("high") < pl.col("low")).height
issues["close_outside_hl"] = df.filter(
(pl.col("close") > pl.col("high")) | (pl.col("close") < pl.col("low"))
).height
# Missing data
issues["null_close"] = df["close"].null_count()
issues["zero_volume"] = df.filter(pl.col("volume") == 0).height
# Extreme returns (likely unadjusted splits)
rets = df.sort("symbol", "timestamp").with_columns(
pl.col("close").pct_change().over("symbol").alias("ret")
)
issues["extreme_returns"] = rets.filter(pl.col("ret").abs() > 0.5).height
# Duplicate timestamps
issues["duplicates"] = (
df.group_by("symbol", "timestamp").len()
.filter(pl.col("len") > 1).height
)
# Stale prices (5+ identical closes in a row)
stale = df.sort("symbol", "timestamp").with_columns(
(pl.col("close") == pl.col("close").shift(1)).over("symbol").alias("same")
)
issues["stale_5d"] = stale.filter(
pl.col("same").rolling_sum(5).over("symbol") >= 5
).height
# Report
for check, count in issues.items():
if count > 0:
print(f" FAIL: {check} = {count}")
return issues
df = pl.read_parquet("prices.parquet")
issues = validate_ohlcv(df)
assert issues["high_lt_low"] == 0, "OHLC consistency violated"
assert issues["duplicates"] == 0, "Duplicate timestamps found"
```
## Corporate Action Detection
Flag likely unadjusted splits: overnight return >40% with no corresponding volume spike. Filter for `abs(ret) > 0.4` AND `volume / rolling_mean(volume, 20) < 3.0` - real moves come with volume, splits do not.
## Guardrails
- Run validation before every model training, not just at initial load
- Extreme returns (>50%) are almost always data errors, not real moves
- Zero-volume days may be valid (halts) or errors - check per-exchange rules
- Stale prices for 5+ consecutive days indicate a dead feed, not a flat market
- Timestamps must be timezone-aware - naive datetimes cause silent alignment errors
## Production Implementation
`ml4t-data` validates provider output during fetches and storage-backed ingest:
```python
from ml4t.data import DataManager
dm = DataManager()
df = dm.fetch("SPY", start="2015-01-01", end="2024-12-31", provider="yahoo")
# Returned OHLCV is validated before it reaches your modeling code
```
## Checklist
- [ ] OHLC consistency verified (high >= low, close within range)
- [ ] Missing values counted and below threshold
- [ ] Duplicate timestamps removed
- [ ] Extreme returns flagged and cross-referenced with corporate actions
- [ ] Stale prices detected
- [ ] Timestamps are timezone-aware
Versions
The database has no other skills named ml4t-validate-data.
Database snapshot: 13.11.2026 · package version ad82c39343ab (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100data-validator
Validate data quality in CSV, JSON, and database exports by checking for missing values, type mismatches, duplicates, outliers, and schema violations. Use when building ETL pipelines, auditing data imports, checking data freshness, or ensuring data contracts between teams.… - 90clean-validate
Design a data validation pipeline — schema checks, range validation, and quality metrics. Use when asked to "validate incoming data", "add schema checks", or "define data quality metrics". - 100detecting-data-anomalies
Process identify anomalies and outliers in datasets using machine learning algorithms. Use when analyzing data for unusual patterns, outliers, or unexpected deviations from normal behavior. Trigger with phrases like "detect anomalies", "find outliers", or "identify unusual patterns". - 100detecting-data-anomalies
Process identify anomalies and outliers in datasets using machine learning algorithms. Use when analyzing data for unusual patterns, outliers, or unexpected deviations from normal behavior. Trigger with phrases like "detect anomalies", "find outliers", or "identify unusual patterns". - 90exploratory-data-analysis
Explore a new dataset systematically to understand its shape, quality, and signal before modeling. Use when you first get a dataset and need to know what is in it, what is wrong with it, and what is worth pursuing. - 100field-validation
Validate data quality in CSV/Excel files for vehicle insurance platform. Use when checking required fields, validating data formats, detecting quality issues, or generating quality reports. Mentions "validate", "check fields", "data quality", "missing values", or "quality score".