Gate a favourite by the require gates and drop its 0.9 floor
A favourite company skips the any group only; a require gate it fails gates it with the usual reason. Its score is the weighted sum with the affinity term at 1, and weights that sum to 0 give "no weights" as for every other company. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
64f367cc18
commit
3ab8035d0d
2 files changed
+101
-18
No files matched your search
+8
-14
@@ -29,8 +29,9 @@ roles out of extract's reach for good.
|
||||
|
||||
Every term is 0..1. The score is the weighted sum over the sum of the weights
|
||||
(the agent's four and its prefer gates'), so it stays 0..1. A favourite
|
||||
company (`affinity = 2`) skips the gates and is floored at 0.9; a hidden one
|
||||
(`-1`) is not scored at all. A role with no vector is scored without `fit`
|
||||
company (`affinity = 2`) skips the `any` group but not the `require` gates, and
|
||||
is scored like any other company with its affinity term at 1: nothing puts
|
||||
its roles above a better fit. A hidden one (`-1`) is not scored at all. A role with no vector is scored without `fit`
|
||||
and `taste`, unless `fit` is all there is, when it is gated as "no vector".
|
||||
An agent with no votes scores every role without `taste`; the direction is
|
||||
newsdesk's `centroid(liked) - centroid(disliked)`. An agent with no prompt
|
||||
@@ -63,9 +64,6 @@ log = logging.getLogger(__name__)
|
||||
|
||||
HALF_LIFE_DAYS = 14.0
|
||||
|
||||
#: Where a favourite company's roles start, whatever else they score.
|
||||
FAVOURITE_FLOOR = 0.9
|
||||
|
||||
#: The `state` key that records the starter agents were imported.
|
||||
SEEDED = "agents:seeded"
|
||||
|
||||
@@ -160,13 +158,13 @@ def failed_gates(candidate: Candidate, gates: Sequence[Gate]) -> list[str]:
|
||||
"""Why this role is gated, as reasons: every require gate it fails, and
|
||||
the `any` group when it matches none of them. A gate with an empty column
|
||||
(state -1) neither passes nor fails, so the group fails only when some
|
||||
member had evidence. None for a favourite, which skips the gates."""
|
||||
if candidate.affinity == 2:
|
||||
return []
|
||||
member had evidence. A favourite company's roles skip the `any` group but
|
||||
not the require gates, so a star widens a search to a company's roles
|
||||
within e.g. Europe, not to the whole world."""
|
||||
states = list(zip(gates, candidate.gates, strict=True))
|
||||
reasons = [_reason(g) for g, state in states if g.mode == "require" and state == 0]
|
||||
group = [(g, state) for g, state in states if g.mode == "any"]
|
||||
if group and not any(state == 1 for _, state in group) \
|
||||
if candidate.affinity != 2 and group and not any(state == 1 for _, state in group) \
|
||||
and any(state == 0 for _, state in group):
|
||||
reasons.append("none of " + ", ".join(_wanted(g) for g, _ in group))
|
||||
return reasons
|
||||
@@ -179,7 +177,6 @@ def score_one(candidate: Candidate, gates: Sequence[Gate], weights: Weights,
|
||||
already scaled to 0..1 (see `scale`), or None when there is nothing to
|
||||
measure: no role vector, no prompt vector, no votes. A None term leaves
|
||||
the denominator; `missing` says why fit is out."""
|
||||
favourite = candidate.affinity == 2
|
||||
if failed := failed_gates(candidate, gates):
|
||||
return 0.0, ", ".join(failed)
|
||||
|
||||
@@ -193,12 +190,9 @@ def score_one(candidate: Candidate, gates: Sequence[Gate], weights: Weights,
|
||||
terms.append((weights.taste, taste))
|
||||
total = sum(w for w, _ in terms)
|
||||
if not total:
|
||||
if favourite:
|
||||
return FAVOURITE_FLOOR, ""
|
||||
# Fit was the only term with any weight, and there is no fit.
|
||||
return 0.0, missing if fit is None and weights.fit else "no weights"
|
||||
score = sum(w * t for w, t in terms) / total
|
||||
return (max(score, FAVOURITE_FLOOR) if favourite else score), ""
|
||||
return sum(w * t for w, t in terms) / total, ""
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ vectors
|
||||
|
||||
Reference in new issue
Block a user