@@ -576,13 +576,21 @@ def _prescore_notes_and_users(
576
576
c .meanNoteScoreKey ,
577
577
c .raterAgreeRatioKey ,
578
578
c .aboveHelpfulnessThresholdKey ,
579
+ c .successfulRatingNotHelpfulCount ,
580
+ c .successfulRatingHelpfulCount ,
581
+ c .unsuccessfulRatingNotHelpfulCount ,
582
+ c .unsuccessfulRatingHelpfulCount ,
583
+ c .totalHelpfulHarassmentRatingsPenaltyKey ,
584
+ c .raterAgreeRatioWithHarassmentAbusePenaltyKey ,
579
585
]
580
586
] = np .nan
581
587
noteParams = noteParamsUnfiltered
582
588
raterParams = raterParamsUnfiltered
583
589
# TODO: delete after we run prescoring diligence properly
584
590
# diligenceGlobalIntercept = None
585
591
finalRoundRatings = ratingsForTraining
592
+ harassmentAbuseNoteParams = noteParamsUnfiltered [[c .noteIdKey ]]
593
+ harassmentAbuseNoteParams [[c .harassmentNoteInterceptKey , c .harassmentNoteFactor1Key ]] = np .nan
586
594
else :
587
595
assert "Topic" not in self .get_name (), f"Unexpected scorer: { self .get_name ()} "
588
596
logger .info (f"Performing rep-filtering for { self .get_name ()} " )
@@ -668,7 +676,15 @@ def _prescore_notes_and_users(
668
676
]
669
677
],
670
678
validRatings [
671
- [c .raterParticipantIdKey , c .ratingAgreesWithNoteStatusKey , c .ratingCountKey ]
679
+ [
680
+ c .raterParticipantIdKey ,
681
+ c .ratingAgreesWithNoteStatusKey ,
682
+ c .ratingCountKey ,
683
+ c .successfulRatingNotHelpfulCount ,
684
+ c .successfulRatingHelpfulCount ,
685
+ c .unsuccessfulRatingNotHelpfulCount ,
686
+ c .unsuccessfulRatingHelpfulCount ,
687
+ ]
672
688
],
673
689
self ._minMeanNoteScore ,
674
690
self ._minCRHVsCRNHRatio ,
@@ -705,10 +721,12 @@ def _prescore_notes_and_users(
705
721
706
722
with self .time_block ("Harassment tag consensus" ):
707
723
harassmentAbuseNoteParams , _ , _ = tag_consensus .train_tag_model (
708
- ratingsHelpfulnessScoreFilteredPreHarassmentFilter ,
709
- c .notHelpfulSpamHarassmentOrAbuseTagKey ,
710
- noteParamsUnfiltered [[c .noteIdKey , c .internalNoteInterceptKey , c .internalNoteFactor1Key ]],
711
- raterParamsUnfiltered [
724
+ ratings = ratingsHelpfulnessScoreFilteredPreHarassmentFilter ,
725
+ tag = c .notHelpfulSpamHarassmentOrAbuseTagKey ,
726
+ helpfulModelNoteParams = noteParamsUnfiltered [
727
+ [c .noteIdKey , c .internalNoteInterceptKey , c .internalNoteFactor1Key ]
728
+ ],
729
+ helpfulModelRaterParams = raterParamsUnfiltered [
712
730
[c .raterParticipantIdKey , c .internalRaterInterceptKey , c .internalRaterFactor1Key ]
713
731
],
714
732
name = "harassment" ,
@@ -731,7 +749,15 @@ def _prescore_notes_and_users(
731
749
]
732
750
],
733
751
validRatings [
734
- [c .raterParticipantIdKey , c .ratingAgreesWithNoteStatusKey , c .ratingCountKey ]
752
+ [
753
+ c .raterParticipantIdKey ,
754
+ c .ratingAgreesWithNoteStatusKey ,
755
+ c .ratingCountKey ,
756
+ c .successfulRatingNotHelpfulCount ,
757
+ c .successfulRatingHelpfulCount ,
758
+ c .unsuccessfulRatingNotHelpfulCount ,
759
+ c .unsuccessfulRatingHelpfulCount ,
760
+ ]
735
761
],
736
762
self ._minMeanNoteScore ,
737
763
self ._minCRHVsCRNHRatio ,
@@ -800,6 +826,14 @@ def _prescore_notes_and_users(
800
826
raterInitStateDiligence = raterParamsDiligenceInit ,
801
827
)
802
828
noteParams = noteParams .merge (diligenceNoteParams , on = c .noteIdKey )
829
+
830
+ noteParams = noteParams .merge (
831
+ harassmentAbuseNoteParams [
832
+ [c .noteIdKey , c .harassmentNoteInterceptKey , c .harassmentNoteFactor1Key ]
833
+ ],
834
+ on = c .noteIdKey ,
835
+ how = "left" ,
836
+ )
803
837
raterParams = raterParams .merge (diligenceRaterParams , on = c .raterParticipantIdKey )
804
838
805
839
# Compute scored notes -- currently not returned; only used for downstream computation.
@@ -892,6 +926,12 @@ def _prescore_notes_and_users(
892
926
c .meanNoteScoreKey ,
893
927
c .raterAgreeRatioKey ,
894
928
c .aboveHelpfulnessThresholdKey ,
929
+ c .successfulRatingHelpfulCount ,
930
+ c .successfulRatingNotHelpfulCount ,
931
+ c .unsuccessfulRatingHelpfulCount ,
932
+ c .unsuccessfulRatingNotHelpfulCount ,
933
+ c .totalHelpfulHarassmentRatingsPenaltyKey ,
934
+ c .raterAgreeRatioWithHarassmentAbusePenaltyKey ,
895
935
]
896
936
],
897
937
on = c .raterParticipantIdKey ,
0 commit comments