Python SDK
fs.score()
SDK Reference: extract or calculate ML Readiness Score
def score(result: ReviewResult) -> MLReadinessScore | None:Overview
Extracts or computes the ML Readiness Score of a dataset. When the provided ReviewResult already carries a score, it is returned directly; otherwise, the score is calculated deterministically from the findings in the result's review sections. This function is a lightweight read-only accessor and never re-runs the data profiling or rule execution stages.
When to Use It
Use when you need to inspect the quality breakdown of a dataset across named dimensions after a review has run. It allows you to check specific dimension ratings, review why points were deducted, and gather suggestions on how to improve the overall score.
Parameters
- result:
ReviewResult. An existing result object produced byfs.review().
Return Value
Returns an MLReadinessScore dataclass (or None if no dimensions are applicable) containing:
scoring_version:str(currently"0.3.0").overall:floatscore scaled from 0.0 to 100.0, representing the weighted average of all applicable dimensions.dimensions: Sequence ofDimensionScoreobjects carrying metrics for Schema Health, Missing Values, Feature Quality, Distribution Health, Leakage Risk, Data Quality, and Consistency.
Each DimensionScore includes a score, weight, rationale, contributing_findings, and suggested_actions.
SDK Example
import featuresmith as fsresult = fs.review("data.csv", target_column="label")score = fs.score(result)if score: print(f"Overall Score: {score.overall}/100") for dim in score.dimensions: if dim.score < 100.0: print(f"[{dim.label}] Rationale: {dim.rationale}") print(f" Actions to improve: {dim.suggested_actions}")Scoring Formula
Each dimension starts at a perfect score of 100.0. Deductions are subtracted based on the severity of the findings in the corresponding section:
- Critical Finding: -30.0 points
- Warning Finding: -15.0 points
- Info Finding: -5.0 points
The overall score is calculated as the weighted average:
Inapplicable dimensions are omitted and their weights are renormalized automatically, ensuring that regression-only datasets are not unfairly penalized for missing classification-specific metrics.
Notes and Limitations
- Read-Only Accessor:
fs.score()does not trigger any profiling or rule-evaluation runs. It is completely derived from pre-existing findings. - Configuration Status: Configuration of custom weights in a
.featuresmith.ymlfile is deferred. The score currently uses uniform default weights (1.0).
Related Documentation
See the review SDK reference fs.review() and the CLI scorecard overview featuresmith score.