Pattern: automated property valuation
Real estate / proptech — automated valuation pattern. Per-segment accuracy, fair-housing parity, image-condition assessment.
Last updated
Was this helpful?
Was this helpful?
# Python (SDK)
from layerlens import Stratix
client = Stratix()
geo_disparity = client.scorers.create_code(
name="geographic-disparity",
code="""
by_tract = group_by_census_tract(traces, scores)
ratio = max_median(by_tract) / min_median(by_tract)
result = {'passed': ratio <= 1.25, 'disparity_ratio': ratio}
""",
)
valuation_accuracy = client.scorers.create_code(
name="valuation-accuracy",
code="result = {'passed': abs(output['estimate'] - expected['appraiser_value']) / expected['appraiser_value'] <= 0.05}",
)
comparable_judge = client.judges.create(
name="comparable-selection",
evaluation_goal="Score 1-5: is the AI's choice of comparable sales defensible against an appraiser's selection?",
)
trace_eval = client.trace_evaluations.create(
trace_set={"tags": {"feature": "avm"}, "sample_rate": 0.01},
scorers=[geo_disparity.id, valuation_accuracy.id],
judges=[comparable_judge.id],
schedule="daily",
)// TypeScript (REST)
const r = await fetch("https://stratix.layerlens.ai/api/v1/trace-evaluations", {
method: "POST",
headers: {
"X-API-Key": process.env.LAYERLENS_STRATIX_API_KEY!,
"Content-Type": "application/json",
},
body: JSON.stringify({
trace_set: { tags: { feature: "avm" }, sample_rate: 0.01 },
scorers: [geoDisparityId, valuationAccuracyId],
judges: [comparableJudgeId],
schedule: "daily",
}),
});