(row: Dict[str, Any], row_vector: Dict[str, float], state: UserFeedbackState)
| 525 | |
| 526 | |
| 527 | def 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 | |
| 560 | def stable_background_rows(rows: List[Dict[str, Any]], label_map: Dict[Tuple[str, str], Dict[str, Any]], limit: int) -> List[Dict[str, Any]]: |
no test coverage detected