InferredConstants.sys.mjs (2378B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 export const FORMAT_ENUM = { 6 SMALL: 0, 7 MEDIUM: 1, 8 LARGE: 2, 9 }; 10 11 export const FORMAT = { 12 "small-card": FORMAT_ENUM.SMALL, 13 "medium-card": FORMAT_ENUM.MEDIUM, 14 "large-card": FORMAT_ENUM.LARGE, 15 }; 16 17 /** 18 * We are exploring two options for interest vectors 19 */ 20 export const MODEL_TYPE = { 21 // Returns clicks and impressions as separate dictionaries 22 CLICK_IMP_PAIR: "click_impression_pair", 23 // Returns a single clicks dictionary, along with the total number of clicks 24 CLICKS: "clicks", 25 CTR: "ctr", 26 }; 27 28 export const CLICK_FEATURE = "click"; 29 30 export const AggregateResultKeys = { 31 POSITION: "position", 32 FEATURE: "feature", 33 VALUE: "feature_value", 34 SECTION_POSITION: "section_position", 35 FORMAT_ENUM: "card_format_enum", 36 }; 37 38 // Clicks feature is handled in certain ways by the model 39 export const SPECIAL_FEATURE_CLICK = "clicks"; 40 41 export const DEFAULT_INFERRED_MODEL_DATA = { 42 model_type: MODEL_TYPE.CLICKS, 43 rescale: true, 44 day_time_weighting: { 45 days: [3, 14, 45], 46 relative_weight: [1, 1, 1], 47 }, 48 interest_vector: { 49 parenting: { 50 features: { parenting: 1 }, 51 thresholds: [0.3, 0.4], 52 diff_p: 0.75, 53 diff_q: 0.25, 54 }, 55 arts: { 56 features: { arts: 1 }, 57 thresholds: [0.3, 0.4], 58 diff_p: 0.75, 59 diff_q: 0.25, 60 }, 61 health: { 62 features: { arts: 1 }, 63 thresholds: [0.3, 0.4], 64 diff_p: 0.75, 65 diff_q: 0.25, 66 }, 67 sports: { 68 features: { sports: 1 }, 69 thresholds: [0.3, 0.4], 70 diff_p: 0.75, 71 diff_q: 0.25, 72 }, 73 society: { 74 features: { society: 1 }, 75 thresholds: [0.3, 0.4], 76 diff_p: 0.75, 77 diff_q: 0.25, 78 }, 79 education: { 80 features: { education: 1 }, 81 thresholds: [0.3, 0.4], 82 diff_p: 0.75, 83 diff_q: 0.25, 84 }, 85 government: { 86 features: { government: 1 }, 87 thresholds: [0.3, 0.4], 88 diff_p: 0.75, 89 diff_q: 0.25, 90 }, 91 [SPECIAL_FEATURE_CLICK]: { 92 features: { click: 1 }, 93 thresholds: [2, 8, 40], 94 diff_p: 0.9, 95 diff_q: 0.1, 96 }, 97 }, 98 }; 99 100 export const DEFAULT_INFERRED_MODEL = { 101 model_id: "default", 102 model_data: DEFAULT_INFERRED_MODEL_DATA, 103 };