From 997ee6b63a48b1a34f733caeaf0010231ef13a6d Mon Sep 17 00:00:00 2001 From: Matt Popovich Date: Fri, 31 Mar 2023 19:03:14 -0600 Subject: [PATCH 1/2] Spell check in 'follow-recommendations-service' folder --- .../java/com/twitter/ann/hnsw/DistancedItemQueue.java | 2 +- .../common/base/RecommendationFlow.scala | 2 +- .../recent_engagement/RepeatedProfileVisitsSource.scala | 2 +- .../TopOrganicFollowsAccountsSource.scala | 4 ++-- .../common/clients/strato/StratoClientModule.scala | 4 ++-- .../common/constants/GuiceNamedConstants.scala | 2 +- .../common/feature_hydration/sources/BUILD | 4 ++-- .../WeightedCandidateSourceRanker.scala | 2 +- .../weighted_sampling/SamplingTransformParams.scala | 2 +- .../flows/ads/PromotedAccountsFlow.scala | 2 +- .../content_recommender_flow/ContentRecommenderFlow.scala | 2 +- .../post_nux_ml/PostNuxMlCombinedRankerBuilder.scala | 2 +- .../flows/post_nux_ml/PostNuxMlFlow.scala | 2 +- .../post_nux_ml/PostNuxMlFlowFeatureSwitchKeys.scala | 2 +- .../follow_recommendations/logging/FrsLogger.scala | 8 ++++---- .../follow_recommendations/modules/FlagsModule.scala | 2 +- .../side_effect/ScribeClientEventSideEffect.scala | 4 ++-- 17 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java index f77f9c2b2..2b29112d4 100644 --- a/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java +++ b/ann/src/main/java/com/twitter/ann/hnsw/DistancedItemQueue.java @@ -18,7 +18,7 @@ public class DistancedItemQueue implements Iterable> { private final PriorityQueue> queue; private final boolean minQueue; /** - * Creates ontainer for items with their distances. + * Creates Container for items with their distances. * * @param origin Origin (reference) point * @param initial Initial list of elements to add in the structure diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/base/RecommendationFlow.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/base/RecommendationFlow.scala index 6bddc9751..ac2efad3e 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/base/RecommendationFlow.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/base/RecommendationFlow.scala @@ -87,7 +87,7 @@ trait RecommendationFlow[Target, Candidate <: UniversalNoun[Long]] protected def selectRanker(target: Target): Ranker[Target, Candidate] /** - * transform the candidates after ranking (e.g. dedupping, grouping and etc) + * transform the candidates after ranking (e.g. deduping, grouping and etc) */ protected def postRankerTransform: Transform[Target, Candidate] diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/recent_engagement/RepeatedProfileVisitsSource.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/recent_engagement/RepeatedProfileVisitsSource.scala index c4b4aa3e7..8f5945cb4 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/recent_engagement/RepeatedProfileVisitsSource.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/recent_engagement/RepeatedProfileVisitsSource.scala @@ -105,7 +105,7 @@ class RepeatedProfileVisitsSource @Inject() ( val recommendationThreshold = params.getInt(RepeatedProfileVisitsParams.RecommendationThreshold) val bucketingThreshold = params.getInt(RepeatedProfileVisitsParams.BucketingThreshold) - // Get the list of repeatedly visited profilts. Only keep accounts with >= bucketingThreshold visits. + // Get the list of repeatedly visited profiles. Only keep accounts with >= bucketingThreshold visits. val repeatedVisitedAccountsStitch: Stitch[Map[Long, Int]] = getRepeatedVisitedAccounts(params, userId).map(_.filter(kv => kv._2 >= bucketingThreshold)) diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/top_organic_follows_accounts/TopOrganicFollowsAccountsSource.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/top_organic_follows_accounts/TopOrganicFollowsAccountsSource.scala index b7f60ece9..991a0ff71 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/top_organic_follows_accounts/TopOrganicFollowsAccountsSource.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/top_organic_follows_accounts/TopOrganicFollowsAccountsSource.scala @@ -86,14 +86,14 @@ class TopOrganicFollowsAccountsSource @Inject() ( debug("candidate source failed identifier = %s".format(identifier), t) errorStats.incr() }) - .map(transformOrganicFollowAccountssToCandidateSource) + .map(transformOrganicFollowAccountsToCandidateSource) }.getOrElse { noCountryCodeStats.incr() Stitch.value(Seq[CandidateUser]()) } } - private def transformOrganicFollowAccountssToCandidateSource( + private def transformOrganicFollowAccountsToCandidateSource( organicFollowsAccounts: Seq[Option[OrganicFollowsAccounts]] ): Seq[CandidateUser] = { organicFollowsAccounts diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/clients/strato/StratoClientModule.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/clients/strato/StratoClientModule.scala index 4046ac754..8accd1282 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/clients/strato/StratoClientModule.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/clients/strato/StratoClientModule.scala @@ -56,7 +56,7 @@ object StratoClientModule extends TwitterModule { val WTFPostNuxFeaturesPath = "ml/featureStore/onboarding/wtfPostNuxFeatures.User" val ElectionCandidatesPath = "onboarding/electionAccounts" val UserUserGraphPath = "recommendations/userUserGraph" - val WtfDissmissEventsPath = "onboarding/wtfDismissEvents" + val WtfDismissEventsPath = "onboarding/wtfDismissEvents" val RelatableAccountsPath = "onboarding/userrecs/relatableAccounts" val ExtendedNetworkCandidatesPath = "search/account_search/extendedNetworkCandidatesMH" val LabeledNotificationPath = "frigate/magicrecs/labeledPushRecsAggregated.User" @@ -234,7 +234,7 @@ object StratoClientModule extends TwitterModule { Unit, (Long, (Long, Long)), WhoToFollowDismissEventDetails - ](WtfDissmissEventsPath) + ](WtfDismissEventsPath) @Provides @Singleton diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/constants/GuiceNamedConstants.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/constants/GuiceNamedConstants.scala index d3d61fa43..efed43d46 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/constants/GuiceNamedConstants.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/constants/GuiceNamedConstants.scala @@ -19,7 +19,7 @@ object GuiceNamedConstants { final val TWO_HOP_RANDOM_WALK_FETCHER = "two_hop_random_walk_fetcher" final val USER_RECOMMENDABILITY_FETCHER = "user_recommendability_fetcher" final val USER_STATE_FETCHER = "user_state_fetcher" - final val UTT_ACCOUNT_RECOMMENDATIONS_FETCHER = "utt_account_recomendations_fetcher" + final val UTT_ACCOUNT_RECOMMENDATIONS_FETCHER = "utt_account_recommendations_fetcher" final val UTT_SEED_ACCOUNTS_FETCHER = "utt_seed_accounts_fetcher" final val ELECTION_CANDIDATES_FETCHER = "election_candidates_fetcher" diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/feature_hydration/sources/BUILD b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/feature_hydration/sources/BUILD index c0538240f..a73e62fb2 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/feature_hydration/sources/BUILD +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/feature_hydration/sources/BUILD @@ -32,8 +32,8 @@ scala_library( "src/scala/com/twitter/ml/featurestore/catalog/features/core:socialgraph", "src/scala/com/twitter/ml/featurestore/catalog/features/core:user", "src/scala/com/twitter/ml/featurestore/catalog/features/interests_discovery:user-topic-relationships", - "src/scala/com/twitter/ml/featurestore/catalog/features/magicrecs:non-mr-notif-summmaries", - "src/scala/com/twitter/ml/featurestore/catalog/features/magicrecs:non-mr-notif-summmary-aggregates", + "src/scala/com/twitter/ml/featurestore/catalog/features/magicrecs:non-mr-notif-summmaries", # TODO: too many m's + "src/scala/com/twitter/ml/featurestore/catalog/features/magicrecs:non-mr-notif-summmary-aggregates", # TODO: too many m's "src/scala/com/twitter/ml/featurestore/catalog/features/magicrecs:nonmr-ntab-summaries", "src/scala/com/twitter/ml/featurestore/catalog/features/onboarding:mc-user-counting", "src/scala/com/twitter/ml/featurestore/catalog/features/onboarding:post-nux-offline", diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/weighted_candidate_source_ranker/WeightedCandidateSourceRanker.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/weighted_candidate_source_ranker/WeightedCandidateSourceRanker.scala index c6f55adbc..02fd3e2bb 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/weighted_candidate_source_ranker/WeightedCandidateSourceRanker.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/weighted_candidate_source_ranker/WeightedCandidateSourceRanker.scala @@ -54,7 +54,7 @@ class WeightedCandidateSourceRanker[Target <: HasParams]( // Note 1: Using map instead mapValue here since mapValue somehow caused infinite loop when used as part of Stream. val sortAndShuffledCandidates = input.map { case (source, candidates) => - // Note 2: toList is required here since candidates is a view, and it will result in infinit loop when used as part of Stream. + // Note 2: toList is required here since candidates is a view, and it will result in infinite loop when used as part of Stream. // Note 3: there is no real sorting logic here, it assumes the input is already sorted by candidate sources val sortedCandidates = candidates.toList source -> shuffleFn(sortedCandidates).iterator diff --git a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/weighted_sampling/SamplingTransformParams.scala b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/weighted_sampling/SamplingTransformParams.scala index 363487a9b..4944cc47f 100644 --- a/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/weighted_sampling/SamplingTransformParams.scala +++ b/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/weighted_sampling/SamplingTransformParams.scala @@ -5,7 +5,7 @@ import com.twitter.timelines.configapi.FSParam object SamplingTransformParams { - case object TopKFixed // indicates how many of the fisrt K who-to-follow recommendations are reserved for the candidates with largest K CandidateUser.score where these candidates are sorted in decreasing order of score + case object TopKFixed // indicates how many of the first K who-to-follow recommendations are reserved for the candidates with largest K CandidateUser.score where these candidates are sorted in decreasing order of score extends FSBoundedParam[Int]( name = "post_nux_ml_flow_weighted_sampling_top_k_fixed", default = 0, diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/ads/PromotedAccountsFlow.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/ads/PromotedAccountsFlow.scala index dd9372484..f55d1f502 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/ads/PromotedAccountsFlow.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/ads/PromotedAccountsFlow.scala @@ -69,7 +69,7 @@ class PromotedAccountsFlow @Inject() ( } /** - * transform the candidates after ranking (e.g. dedupping, grouping and etc) + * transform the candidates after ranking (e.g. deduping, grouping and etc) */ protected override def postRankerTransform: Transform[ PromotedAccountsFlowRequest, diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/content_recommender_flow/ContentRecommenderFlow.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/content_recommender_flow/ContentRecommenderFlow.scala index 30dfa0d42..feeec1942 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/content_recommender_flow/ContentRecommenderFlow.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/content_recommender_flow/ContentRecommenderFlow.scala @@ -133,7 +133,7 @@ class ContentRecommenderFlow @Inject() ( CandidateUser ] = { new DedupTransform[ContentRecommenderRequest, CandidateUser] - .observe(statsReceiver.scope("dedupping")) + .observe(statsReceiver.scope("deduping")) } protected override def validateCandidates: Predicate[ diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlCombinedRankerBuilder.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlCombinedRankerBuilder.scala index 14e982a41..4ea6d56a7 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlCombinedRankerBuilder.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlCombinedRankerBuilder.scala @@ -29,7 +29,7 @@ import com.twitter.timelines.configapi.HasParams * - truncating to the top N merged results for ranking * - ML ranker * - Interleaving ranker for producer-side experiments - * - impression-based fatigueing + * - impression-based fatiguing */ @Singleton class PostNuxMlCombinedRankerBuilder[ diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlow.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlow.scala index 092f07100..f312f526c 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlow.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlow.scala @@ -175,7 +175,7 @@ class PostNuxMlFlow @Inject() ( override protected val postRankerTransform: Transform[PostNuxMlRequest, CandidateUser] = { new DedupTransform[PostNuxMlRequest, CandidateUser] - .observe(statsReceiver.scope("dedupping")) + .observe(statsReceiver.scope("deduping")) .andThen( samplingTransform .gated(PostNuxMlParams.SamplingTransformEnabled) diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlowFeatureSwitchKeys.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlowFeatureSwitchKeys.scala index 6a44c4bbb..239d4fe1d 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlowFeatureSwitchKeys.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/flows/post_nux_ml/PostNuxMlFlowFeatureSwitchKeys.scala @@ -23,5 +23,5 @@ object PostNuxMlFlowFeatureSwitchKeys { val EnableSGSPredicate = "post_nux_ml_flow_enable_sgs_predicate" val EnableHssPredicate = "post_nux_ml_flow_enable_hss_predicate" val GetFollowersFromSgs = "post_nux_ml_flow_get_followers_from_sgs" - val TurnOffMLScorerQFThreshold = "post_nux_ml_flow_turn_off_ml_scorer_threhsold" + val TurnOffMLScorerQFThreshold = "post_nux_ml_flow_turn_off_ml_scorer_threshold" } diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/logging/FrsLogger.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/logging/FrsLogger.scala index 8b920c556..7b9f40514 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/logging/FrsLogger.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/logging/FrsLogger.scala @@ -16,7 +16,7 @@ import com.twitter.logging.LoggerFactory import com.twitter.product_mixer.core.model.marshalling.request.ClientContext import com.twitter.product_mixer.core.model.marshalling.request.HasClientContext import com.twitter.scribelib.marshallers.ClientDataProvider -import com.twitter.scribelib.marshallers.ExternalRefererDataProvider +import com.twitter.scribelib.marshallers.ExternalReferrerDataProvider import com.twitter.scribelib.marshallers.ScribeSerialization import com.twitter.timelines.configapi.HasParams import com.twitter.util.Time @@ -125,7 +125,7 @@ object FrsLogger { /** The id of the current user. When the user is logged out, this method should return None. */ override val userId: Option[Long] = clientContext.userId - /** The id of the guest, which is present in logged-in or loged-out states */ + /** The id of the guest, which is present in logged-in or logged-out states */ override val guestId: Option[Long] = clientContext.guestId /** The personalization id (pid) of the user, used to personalize Twitter services */ @@ -153,12 +153,12 @@ object FrsLogger { override val isSsl: Option[Boolean] = Some(true) /** The referring URL to the current page for web-based clients, if applicable */ - override val referer: Option[String] = None + override val referrer: Option[String] = None /** * The external site, partner, or email that lead to the current Twitter application. Returned value consists of a * tuple including the encrypted referral data and the type of referral */ - override val externalReferer: Option[ExternalRefererDataProvider] = None + override val externalReferrer: Option[ExternalReferrerDataProvider] = None } } diff --git a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/modules/FlagsModule.scala b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/modules/FlagsModule.scala index f8ff5ae94..f232b4996 100644 --- a/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/modules/FlagsModule.scala +++ b/follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/modules/FlagsModule.scala @@ -8,7 +8,7 @@ object FlagsModule extends TwitterModule { ) flag[Boolean]( name = "interests_opt_out_prod_enabled", - help = "Whether to fetch intersts opt out data from the prod strato column or not" + help = "Whether to fetch interests opt out data from the prod strato column or not" ) flag[Boolean]( name = "log_results", diff --git a/product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/side_effect/ScribeClientEventSideEffect.scala b/product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/side_effect/ScribeClientEventSideEffect.scala index bee6ec92e..ed477b40b 100644 --- a/product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/side_effect/ScribeClientEventSideEffect.scala +++ b/product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/side_effect/ScribeClientEventSideEffect.scala @@ -98,8 +98,8 @@ trait ScribeClientEventSideEffect[ override val languageCode = query.clientContext.languageCode override val userAgent = query.clientContext.userAgent override val isSsl = None - override val referer = None - override val externalReferer = None + override val referrer = None + override val externalReferrer = None } } } From b1bc8b25411b0e8d2c211bf1f7fcd365e17ae618 Mon Sep 17 00:00:00 2001 From: Matt Popovich Date: Fri, 31 Mar 2023 19:11:11 -0600 Subject: [PATCH 2/2] Fixes #535 --- simclusters-ann/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simclusters-ann/README.md b/simclusters-ann/README.md index 8770435cd..69ff6cffa 100644 --- a/simclusters-ann/README.md +++ b/simclusters-ann/README.md @@ -15,7 +15,7 @@ SimClusters from the Linear Algebra Perspective discussed the difference between However, calculating the cosine similarity between two Tweets is pretty expensive in Tweet candidate generation. In TWISTLY, we scan at most 15,000 (6 source tweets * 25 clusters * 100 tweets per clusters) tweet candidates for every Home Timeline request. The traditional algorithm needs to make API calls to fetch 15,000 tweet SimCluster embeddings. Consider that we need to process over 6,000 RPS, it’s hard to support by the existing infrastructure. -## SimClusters Approximate Cosine Similariy Core Algorithm +## SimClusters Approximate Cosine Similarity Core Algorithm 1. Provide a source SimCluster Embedding *SV*, *SV = [(SC1, Score), (SC2, Score), (SC3, Score) …]*