← Back to all articles

AI trust

Implement smooth weighted scores without moving the chart scale

A runnable weighted mean plus a bounded display transform.

AI-generated editorial illustration.

1. Separate three different objects

Keep the model’s base scores, its original vote and the user’s fit ranking as separate data. A slider should change the fit calculation, not claim that a provider reconsidered its opinion. Define the neutral slider position as balanced. In the implementation below, the slider runs from minus one hundred to one hundred and maps exponentially to a weight from one half to two. This provides a symmetric middle on the importance scale without exposing confusing multiplier labels as the main interface.

2. Calculate totals on shared valid dimensions

A weighted mean remains bounded by valid base scores when all weights are positive. If any option lacks a score in a dimension, exclude that dimension from every option’s total for this view. Do not quietly insert zero, and do not divide each product by a different set of weights. With no shared dimensions, return no ranking rather than manufacturing a tie at zero. The example preserves a genuine zero as a numeric score and includes tests for the important edge cases.

import math

def weight(position):
    return 2 ** (max(-100, min(100, position)) / 100)

def totals(rows, weights):
    valid = [all(type(v) in (int,float) and math.isfinite(v) for v in row) for row in rows]
    denominator = sum(w for w, ok in zip(weights, valid) if ok)
    if not denominator:
        return None
    return [sum(row[j]*w for row,w,ok in zip(rows,weights,valid) if ok)/denominator
            for j in range(len(rows[0]))]

def profile(score, position):
    if score is None:
        return None
    s = max(0, min(100, score))
    p = max(-1, min(1, position/100))
    return max(0, min(100, s + .25*p*s*(1-s/100)))

assert weight(0) == 1 and weight(100) == 2
assert totals([[90,80],[None,95]], [1,2]) == [90,80]
assert totals([[None,80]], [1]) is None
assert totals([[0,80]], [1]) == [0,80]
assert 90 < profile(90,100) < 100
print([round(x,1) for x in totals([[90,80],[80,95]], [1,weight(30)])])

3. Keep the grid fixed

A chart’s grid must represent the same zero-to-one-hundred scale before and after an adjustment. If importance is also reflected in a polygon profile, label that profile as a display transform and retain the original score in the tooltip. The bounded transform in the example changes a point gently and cannot exceed the outer scale. Missing points should be omitted, with only adjacent known segments connected. Do not draw a closed polygon through the center to represent an unknown value; that visually claims a real zero.

4. Test ranking sensitivity and reversibility

Use fixtures where two products trade advantages across dimensions, then vary one slider in small steps. Check bounds, missing-data behavior and exact recovery after reset. Confirm that adjusting a control produces no model request. Keep a narrow numerical lead visually different from a broad advantage, and explain when the result is sensitive to preferences. The math does not make subjective AI scores into laboratory measurements. It makes the consequences of a user preference explicit and reproducible.

Compare your options →Explore GEO ↗

All product names, logos and brands belong to their respective owners and are used for identification only. VersusSmart is an independent service and is not affiliated with, sponsored by or endorsed by these providers.