MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / score_row

Function score_row

experiments/baselines/scholar_inbox/runner.py:527–557  ·  view source on GitHub ↗
(row: Dict[str, Any], row_vector: Dict[str, float], state: UserFeedbackState)

Source from the content-addressed store, hash-verified

525
526
527def score_row(row: Dict[str, Any], row_vector: Dict[str, float], state: UserFeedbackState) -> Dict[str, Any]:
528 content, positive, negative, uses_classifier = content_score(row_vector, state)
529 cold = scaled_similarity(row_vector, state.profile_vector)
530 author = author_match_score(row, state.profile)
531 institution = institution_match_score(row, state.profile)
532 keyword = keyword_match_score(row, state.profile)
533 source = source_prior(row)
534 final_score = (
535 SCORE_WEIGHTS["content"] * content
536 + SCORE_WEIGHTS["cold_start"] * cold
537 + SCORE_WEIGHTS["author"] * author
538 + SCORE_WEIGHTS["institution"] * institution
539 + SCORE_WEIGHTS["keyword"] * keyword
540 + SCORE_WEIGHTS["source"] * source
541 )
542 final_score = clamp(final_score)
543 return {
544 "system_score": final_score,
545 "system_label": label_for_score(final_score),
546 "content_score": content,
547 "cold_start_score": cold,
548 "positive_similarity": positive,
549 "negative_similarity": negative,
550 "author_match_score": author,
551 "institution_match_score": institution,
552 "keyword_match_score": keyword,
553 "source_prior": source,
554 "uses_feedback_classifier": uses_classifier,
555 "training_positive_count": state.positive_count,
556 "training_negative_count": state.negative_count,
557 }
558
559
560def stable_background_rows(rows: List[Dict[str, Any]], label_map: Dict[Tuple[str, str], Dict[str, Any]], limit: int) -> List[Dict[str, Any]]:

Callers 1

rerank_episodesFunction · 0.70

Calls 8

author_match_scoreFunction · 0.85
institution_match_scoreFunction · 0.85
keyword_match_scoreFunction · 0.85
content_scoreFunction · 0.70
scaled_similarityFunction · 0.70
source_priorFunction · 0.70
clampFunction · 0.70
label_for_scoreFunction · 0.70

Tested by

no test coverage detected