similarty + other typo fixes

This commit is contained in:
Suneel Rahman 2023-04-03 20:06:44 -04:00
parent ec83d01dca
commit 7380e27c93
6 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ import com.twitter.cr_mixer.module.similarity_engine.ProducerBasedUnifiedSimilar
import com.twitter.cr_mixer.module.similarity_engine.SimClustersANNSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.SimClustersANNSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUnifiedSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUnifiedSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedQigSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedQigSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedTwHINSimlarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedTwHINSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserAdGraphSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserAdGraphSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserTweetGraphSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserTweetGraphSimilarityEngineModule
import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserVideoGraphSimilarityEngineModule import com.twitter.cr_mixer.module.similarity_engine.TweetBasedUserVideoGraphSimilarityEngineModule
@ -180,7 +180,7 @@ class CrMixerServer extends ThriftServer with Mtls with HttpServer with HttpMtls
TripCandidateStoreModule, TripCandidateStoreModule,
TwiceClustersMembersStoreModule, TwiceClustersMembersStoreModule,
TweetBasedQigSimilarityEngineModule, TweetBasedQigSimilarityEngineModule,
TweetBasedTwHINSimlarityEngineModule, TweetBasedTwHINSimilarityEngineModule,
TweetBasedUnifiedSimilarityEngineModule, TweetBasedUnifiedSimilarityEngineModule,
TweetBasedUserAdGraphSimilarityEngineModule, TweetBasedUserAdGraphSimilarityEngineModule,
TweetBasedUserTweetGraphSimilarityEngineModule, TweetBasedUserTweetGraphSimilarityEngineModule,

View File

@ -21,7 +21,7 @@ import com.twitter.cr_mixer.similarity_engine.SimilarityEngine.SimilarityEngineC
import com.twitter.cr_mixer.thriftscala.SimilarityEngineType import com.twitter.cr_mixer.thriftscala.SimilarityEngineType
import com.twitter.finagle.memcached.{Client => MemcachedClient} import com.twitter.finagle.memcached.{Client => MemcachedClient}
object TweetBasedTwHINSimlarityEngineModule extends TwitterModule { object TweetBasedTwHINSimilarityEngineModule extends TwitterModule {
@Provides @Provides
@Named(ModuleNames.TweetBasedTwHINANNSimilarityEngine) @Named(ModuleNames.TweetBasedTwHINANNSimilarityEngine)
def providesTweetBasedTwHINANNSimilarityEngine( def providesTweetBasedTwHINANNSimilarityEngine(

View File

@ -6,7 +6,7 @@ enum FeatureVal {
FloatVector(Vec<f32>), FloatVector(Vec<f32>),
} }
// A Feture has a name and a value // A Feature has a name and a value
// The name for now is 'id' of type string // The name for now is 'id' of type string
// Eventually this needs to be flexible - example to accomodate feature-id // Eventually this needs to be flexible - example to accomodate feature-id
struct Feature { struct Feature {

View File

@ -149,7 +149,7 @@ public class EarlybirdFeatureSchemaMerger {
* (This is done inside superroot) * (This is done inside superroot)
* @param requestContext the search request context * @param requestContext the search request context
* @param mergedResponse the merged result inside the superroot * @param mergedResponse the merged result inside the superroot
* @param realtimeResponse the realtime tier resposne * @param realtimeResponse the realtime tier response
* @param protectedResponse the protected tier response * @param protectedResponse the protected tier response
* @param fullArchiveResponse the full archive tier response * @param fullArchiveResponse the full archive tier response
* @param statsPrefix * @param statsPrefix

View File

@ -178,7 +178,7 @@ RawTensor TensorRecordReader::readStringTensor() {
CHECK_THRIFT_TYPE(readByte(), TTYPE_STRING, "data_type"); CHECK_THRIFT_TYPE(readByte(), TTYPE_STRING, "data_type");
length = readInt32(); length = readInt32();
// Store the current location of the byte stream. // Store the current location of the byte stream.
// Use this at to "deocde strings" at a later point. // Use this at to "decode strings" at a later point.
data = getBuffer(); data = getBuffer();
for (int32_t i = 0; i < length; i++) { for (int32_t i = 0; i < length; i++) {
// Skip reading the strings // Skip reading the strings

View File

@ -7,7 +7,7 @@ from tensorflow.python.ops import array_ops, math_ops
def safe_div(numerator, denominator, name=None): def safe_div(numerator, denominator, name=None):
""" """
Example usage: calculating NDCG = DCG / IDCG to handle cases when Example usage: calculating NDCG = DCG / IDCG to handle cases when
IDCG = 0 returns 0 instead of Infinity IDCG = 0 returns 0 instead of Infinity
Do not use this dividing funciton unless it makes sense to your problem Do not use this dividing funciton unless it makes sense to your problem
Divides two tensors element-wise, returns 0 if the denominator is <= 0. Divides two tensors element-wise, returns 0 if the denominator is <= 0.
Args: Args:
@ -56,7 +56,7 @@ def cal_swapped_ndcg(label_scores, predicted_scores, top_k_int):
Args: Args:
label_scores: a real `Tensor`. label_scores: a real `Tensor`.
predicted_scores: a real `Tensor`, with dtype matching label_scores predicted_scores: a real `Tensor`, with dtype matching label_scores
top_k_int: An int or an int `Tensor`. top_k_int: An int or an int `Tensor`.
Returns: Returns:
a `Tensor` that holds swapped NDCG by . a `Tensor` that holds swapped NDCG by .
""" """
@ -100,7 +100,7 @@ def _dcg_idcg(relevance_scores, cg_discount):
relevance_scores: a real `Tensor`. relevance_scores: a real `Tensor`.
cg_discount: a real `Tensor`, with dtype matching relevance_scores cg_discount: a real `Tensor`, with dtype matching relevance_scores
Returns: Returns:
a `Tensor` that holds \\sum_{i=1}^k \frac{relevance_scores_k}{cg_discount} a `Tensor` that holds \\sum_{i=1}^k \frac{relevance_scores_k}{cg_discount}
""" """
# cg_discount is safe # cg_discount is safe
dcg_k = relevance_scores / cg_discount dcg_k = relevance_scores / cg_discount
@ -115,8 +115,8 @@ def _get_ranking_orders(label_scores, predicted_scores, top_k_int=1):
predicted_scores: a real `Tensor`, with dtype matching label_scores predicted_scores: a real `Tensor`, with dtype matching label_scores
top_k_int: an integer or an int `Tensor`. top_k_int: an integer or an int `Tensor`.
Returns: Returns:
two `Tensors` that hold sorted_labels: the ground truth relevance socres two `Tensors` that hold sorted_labels: the ground truth relevance scores
and predicted_order: relevance socres based on sorted predicted_scores and predicted_order: relevance scores based on sorted predicted_scores
""" """
# sort predictions_scores and label_scores # sort predictions_scores and label_scores
# size [batch_size/num of DataRecords, 1] # size [batch_size/num of DataRecords, 1]
@ -141,7 +141,7 @@ def _get_cg_discount(top_k_int=1):
Args: Args:
top_k_int: An int or an int `Tensor`. top_k_int: An int or an int `Tensor`.
Returns: Returns:
a `Tensor` that holds \log_{2}(i + 1), i \in [1, k] a `Tensor` that holds \log_{2}(i + 1), i \in [1, k]
""" """
log_2 = tf.log(tf.constant(2.0, dtype=tf.float32)) log_2 = tf.log(tf.constant(2.0, dtype=tf.float32))
# top_k_range needs to start from 1 to top_k_int # top_k_range needs to start from 1 to top_k_int