diff --git a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/inline_content_ads/eligible_inline_content_ads_v2_unittest.cc b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/inline_content_ads/eligible_inline_content_ads_v2_unittest.cc index 34a8d617fd5a..1039915e2f9d 100644 --- a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/inline_content_ads/eligible_inline_content_ads_v2_unittest.cc +++ b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/inline_content_ads/eligible_inline_content_ads_v2_unittest.cc @@ -41,64 +41,73 @@ TEST_F(BraveAdsEligibleInlineContentAdsV2Test, GetAds) { // Arrange CreativeInlineContentAdList creative_ads; - CreativeInlineContentAdInfo creative_ad_1 = - test::BuildCreativeInlineContentAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo-bar1"; + const CreativeInlineContentAdInfo creative_ad_1 = + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); creative_ads.push_back(creative_ad_1); CreativeInlineContentAdInfo creative_ad_2 = - test::BuildCreativeInlineContentAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar3"; + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent"; creative_ads.push_back(creative_ad_2); + CreativeInlineContentAdInfo creative_ad_3 = + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); + creative_ad_3.segment = "parent-child"; + creative_ads.push_back(creative_ad_3); + database::SaveCreativeInlineContentAds(creative_ads); // Act & Assert base::MockCallback> callback; - EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); + EXPECT_CALL(callback, Run(CreativeInlineContentAdList{creative_ad_1})); eligible_ads_->GetForUserModel( UserModelInfo{ - IntentUserModelInfo{SegmentList{"foo-bar1", "foo-bar2"}}, + IntentUserModelInfo{}, LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"foo-bar3"}}, + InterestUserModelInfo{SegmentList{"untargeted"}}, }, /*dimensions=*/"200x100", callback.Get()); } -TEST_F(BraveAdsEligibleInlineContentAdsV2Test, GetAdsForNoSegments) { +TEST_F(BraveAdsEligibleInlineContentAdsV2Test, GetAdsForNoMatchingSegments) { // Arrange CreativeInlineContentAdList creative_ads; CreativeInlineContentAdInfo creative_ad_1 = - test::BuildCreativeInlineContentAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo"; + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); + creative_ad_1.segment = "parent"; creative_ads.push_back(creative_ad_1); CreativeInlineContentAdInfo creative_ad_2 = - test::BuildCreativeInlineContentAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar"; + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent-child"; creative_ads.push_back(creative_ad_2); database::SaveCreativeInlineContentAds(creative_ads); // Act & Assert base::MockCallback> callback; - EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); + EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel(/*user_model=*/{}, /*dimensions=*/"200x100", callback.Get()); } TEST_F(BraveAdsEligibleInlineContentAdsV2Test, DoNotGetAdsForNonExistentDimensions) { + // Arrange + CreativeInlineContentAdList creative_ads; + + const CreativeInlineContentAdInfo creative_ad = + test::BuildCreativeInlineContentAd(/*should_use_random_uuids=*/true); + creative_ads.push_back(creative_ad); + + database::SaveCreativeInlineContentAds(creative_ads); + // Act & Assert base::MockCallback> callback; EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); - eligible_ads_->GetForUserModel( - UserModelInfo{ - IntentUserModelInfo{SegmentList{"intent-foo", "intent-bar"}}, - LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"interest-foo", "interest-bar"}}}, - /*dimensions=*/"?x?", callback.Get()); + eligible_ads_->GetForUserModel(UserModelInfo{}, + /*dimensions=*/"?x?", callback.Get()); } TEST_F(BraveAdsEligibleInlineContentAdsV2Test, DoNotGetAdsIfNoEligibleAds) { @@ -107,9 +116,9 @@ TEST_F(BraveAdsEligibleInlineContentAdsV2Test, DoNotGetAdsIfNoEligibleAds) { EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel( UserModelInfo{ - IntentUserModelInfo{SegmentList{"intent-foo", "intent-bar"}}, + IntentUserModelInfo{SegmentList{"parent-child", "parent"}}, LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"interest-foo", "interest-bar"}}}, + InterestUserModelInfo{SegmentList{"parent-child", "parent"}}}, /*dimensions=*/"200x100", callback.Get()); } diff --git a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/new_tab_page_ads/eligible_new_tab_page_ads_v2_unittest.cc b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/new_tab_page_ads/eligible_new_tab_page_ads_v2_unittest.cc index caaeea45c85f..2d42b57ba7e8 100644 --- a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/new_tab_page_ads/eligible_new_tab_page_ads_v2_unittest.cc +++ b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/new_tab_page_ads/eligible_new_tab_page_ads_v2_unittest.cc @@ -40,47 +40,50 @@ TEST_F(BraveAdsEligibleNewTabPageAdsV2Test, GetAds) { // Arrange CreativeNewTabPageAdList creative_ads; - CreativeNewTabPageAdInfo creative_ad_1 = - test::BuildCreativeNewTabPageAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo-bar1"; + const CreativeNewTabPageAdInfo creative_ad_1 = + test::BuildCreativeNewTabPageAd(/*should_use_random_uuids=*/true); creative_ads.push_back(creative_ad_1); CreativeNewTabPageAdInfo creative_ad_2 = - test::BuildCreativeNewTabPageAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar3"; + test::BuildCreativeNewTabPageAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent"; creative_ads.push_back(creative_ad_2); + CreativeNewTabPageAdInfo creative_ad_3 = + test::BuildCreativeNewTabPageAd(/*should_use_random_uuids=*/true); + creative_ad_3.segment = "parent-child"; + creative_ads.push_back(creative_ad_3); + database::SaveCreativeNewTabPageAds(creative_ads); // Act & Assert base::MockCallback> callback; - EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); + EXPECT_CALL(callback, Run(CreativeNewTabPageAdList{creative_ad_1})); eligible_ads_->GetForUserModel( - UserModelInfo{IntentUserModelInfo{SegmentList{"foo-bar1", "foo-bar2"}}, - LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"foo-bar3"}}}, + UserModelInfo{IntentUserModelInfo{}, LatentInterestUserModelInfo{}, + InterestUserModelInfo{SegmentList{"untargeted"}}}, callback.Get()); } -TEST_F(BraveAdsEligibleNewTabPageAdsV2Test, GetAdsForNoSegments) { +TEST_F(BraveAdsEligibleNewTabPageAdsV2Test, GetAdsForNoMatchingSegments) { // Arrange CreativeNewTabPageAdList creative_ads; CreativeNewTabPageAdInfo creative_ad_1 = - test::BuildCreativeNewTabPageAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo"; + test::BuildCreativeNewTabPageAd(/*should_use_random_uuids=*/true); + creative_ad_1.segment = "parent"; creative_ads.push_back(creative_ad_1); CreativeNewTabPageAdInfo creative_ad_2 = - test::BuildCreativeNewTabPageAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar"; + test::BuildCreativeNewTabPageAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent-child"; creative_ads.push_back(creative_ad_2); database::SaveCreativeNewTabPageAds(creative_ads); // Act & Assert base::MockCallback> callback; - EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); + EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel(/*user_model=*/{}, callback.Get()); } @@ -90,9 +93,9 @@ TEST_F(BraveAdsEligibleNewTabPageAdsV2Test, DoNotGetAdsIfNoEligibleAds) { EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel( UserModelInfo{ - IntentUserModelInfo{SegmentList{"intent-foo", "intent-boo"}}, + IntentUserModelInfo{SegmentList{"parent-child", "parent"}}, LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"interest-foo", "interest-bar"}}}, + InterestUserModelInfo{SegmentList{"parent-child", "parent"}}}, callback.Get()); } diff --git a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/notification_ads/eligible_notification_ads_v2_unittest.cc b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/notification_ads/eligible_notification_ads_v2_unittest.cc index e04cabd396ce..8afdc9c5b8dd 100644 --- a/components/brave_ads/core/internal/serving/eligible_ads/pipelines/notification_ads/eligible_notification_ads_v2_unittest.cc +++ b/components/brave_ads/core/internal/serving/eligible_ads/pipelines/notification_ads/eligible_notification_ads_v2_unittest.cc @@ -41,13 +41,13 @@ TEST_F(BraveAdsEligibleNotificationAdsV2Test, GetAds) { CreativeNotificationAdList creative_ads; CreativeNotificationAdInfo creative_ad_1 = - test::BuildCreativeNotificationAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo-bar1"; + test::BuildCreativeNotificationAd(/*should_use_random_uuids=*/true); + creative_ad_1.segment = "parent-child-1"; creative_ads.push_back(creative_ad_1); CreativeNotificationAdInfo creative_ad_2 = - test::BuildCreativeNotificationAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar3"; + test::BuildCreativeNotificationAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent-child-3"; creative_ads.push_back(creative_ad_2); database::SaveCreativeNotificationAds(creative_ads); @@ -56,31 +56,32 @@ TEST_F(BraveAdsEligibleNotificationAdsV2Test, GetAds) { base::MockCallback> callback; EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); eligible_ads_->GetForUserModel( - UserModelInfo{IntentUserModelInfo{SegmentList{"foo-bar1", "foo-bar2"}}, - LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"foo-bar3"}}}, + UserModelInfo{ + IntentUserModelInfo{SegmentList{"parent-child-1", "parent-child-2"}}, + LatentInterestUserModelInfo{}, + InterestUserModelInfo{SegmentList{"parent-child-3"}}}, callback.Get()); } -TEST_F(BraveAdsEligibleNotificationAdsV2Test, GetAdsForNoSegments) { +TEST_F(BraveAdsEligibleNotificationAdsV2Test, GetAdsForNoMatchingSegments) { // Arrange CreativeNotificationAdList creative_ads; CreativeNotificationAdInfo creative_ad_1 = - test::BuildCreativeNotificationAd(/*should_generate_random_uuids=*/true); - creative_ad_1.segment = "foo"; + test::BuildCreativeNotificationAd(/*should_use_random_uuids=*/true); + creative_ad_1.segment = "parent"; creative_ads.push_back(creative_ad_1); CreativeNotificationAdInfo creative_ad_2 = - test::BuildCreativeNotificationAd(/*should_generate_random_uuids=*/true); - creative_ad_2.segment = "foo-bar"; + test::BuildCreativeNotificationAd(/*should_use_random_uuids=*/true); + creative_ad_2.segment = "parent-child"; creative_ads.push_back(creative_ad_2); database::SaveCreativeNotificationAds(creative_ads); // Act & Assert base::MockCallback> callback; - EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::SizeIs(1))); + EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel(/*user_model=*/{}, callback.Get()); } @@ -90,9 +91,9 @@ TEST_F(BraveAdsEligibleNotificationAdsV2Test, DoNotGetAdsIfNoEligibleAds) { EXPECT_CALL(callback, Run(/*creative_ads=*/::testing::IsEmpty())); eligible_ads_->GetForUserModel( UserModelInfo{ - IntentUserModelInfo{SegmentList{"intent-foo", "intent-bar"}}, + IntentUserModelInfo{SegmentList{"parent-child", "parent"}}, LatentInterestUserModelInfo{}, - InterestUserModelInfo{SegmentList{"interest-foo", "interest-bar"}}}, + InterestUserModelInfo{SegmentList{"parent-child", "parent"}}}, callback.Get()); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_ad_model_based_predictor_util_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/creative_ad_model_based_predictor_util_unittest.cc index 2a0b47798ddb..5672c71fc53c 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_ad_model_based_predictor_util_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_ad_model_based_predictor_util_unittest.cc @@ -81,7 +81,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorUtilTest, .value = false; expected_creative_ad_predictor_1.input_variable.interest_segment .parent_matches.value = true; - expected_creative_ad_predictor_1.score = 3.0; + expected_creative_ad_predictor_1.score = 2.0; expected_creative_ad_predictors.push_back(expected_creative_ad_predictor_1); CreativeAdModelBasedPredictorInfo @@ -101,7 +101,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorUtilTest, .parent_matches.value = false; expected_creative_ad_predictor_2.input_variable.last_seen_ad.value = base::Hours(3); - expected_creative_ad_predictor_2.score = 0.125; + expected_creative_ad_predictor_2.score = 0.0; expected_creative_ad_predictors.push_back(expected_creative_ad_predictor_2); CreativeAdModelBasedPredictorInfo @@ -119,7 +119,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorUtilTest, .value = true; expected_creative_ad_predictor_3.input_variable.interest_segment .parent_matches.value = true; - expected_creative_ad_predictor_3.score = 3.0; + expected_creative_ad_predictor_3.score = 2.0; expected_creative_ad_predictors.push_back(expected_creative_ad_predictor_3); EXPECT_EQ(expected_creative_ad_predictors, creative_ad_predictors); diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature.h b/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature.h index e13ea2bbce46..9f8d9a2d0a1c 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature.h +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature.h @@ -48,7 +48,7 @@ inline constexpr base::FeatureParam inline constexpr base::FeatureParam kInlineContentAdLastSeenPredictorWeight{ &kCreativeInlineContentAdModelBasedPredictorFeature, - "last_seen_ad_predictor_weight", 1.0}; + "last_seen_ad_predictor_weight", 0.0}; } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature_unittest.cc index d482a426bf6f..96eaa0a81777 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_inline_content_ad_model_based_predictor_feature_unittest.cc @@ -268,7 +268,7 @@ TEST(BraveAdsCreativeInlineContentAdModelBasedPredictorFeatureTest, TEST(BraveAdsCreativeInlineContentAdModelBasedPredictorFeatureTest, DefaultLastSeenAdPredictorWeight) { // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kInlineContentAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kInlineContentAdLastSeenPredictorWeight.Get()); } TEST(BraveAdsCreativeInlineContentAdModelBasedPredictorFeatureTest, @@ -279,7 +279,7 @@ TEST(BraveAdsCreativeInlineContentAdModelBasedPredictorFeatureTest, kCreativeInlineContentAdModelBasedPredictorFeature); // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kInlineContentAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kInlineContentAdLastSeenPredictorWeight.Get()); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature.h b/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature.h index a89bec3abfaf..4c09447c51cc 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature.h +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature.h @@ -48,7 +48,7 @@ inline constexpr base::FeatureParam inline constexpr base::FeatureParam kNewTabPageAdLastSeenPredictorWeight{ &kCreativeNewTabPageAdModelBasedPredictorFeature, - "last_seen_ad_predictor_weight", 1.0}; + "last_seen_ad_predictor_weight", 0.0}; } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature_unittest.cc index e438b0e67387..6847232e606c 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_new_tab_page_ad_model_based_predictor_feature_unittest.cc @@ -256,7 +256,7 @@ TEST(BraveAdsCreativeNewTabPageAdModelBasedPredictorFeatureTest, TEST(BraveAdsCreativeNewTabPageAdModelBasedPredictorFeatureTest, DefaultLastSeenAdPredictorWeight) { // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kNewTabPageAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kNewTabPageAdLastSeenPredictorWeight.Get()); } TEST(BraveAdsCreativeNewTabPageAdModelBasedPredictorFeatureTest, @@ -267,7 +267,7 @@ TEST(BraveAdsCreativeNewTabPageAdModelBasedPredictorFeatureTest, kCreativeNewTabPageAdModelBasedPredictorFeature); // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kNewTabPageAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kNewTabPageAdLastSeenPredictorWeight.Get()); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature.h b/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature.h index b2d5f986959f..78dd0c8bcb3f 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature.h +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature.h @@ -48,7 +48,7 @@ inline constexpr base::FeatureParam inline constexpr base::FeatureParam kNotificationAdLastSeenPredictorWeight{ &kCreativeNotificationAdModelBasedPredictorFeature, - "last_seen_ad_predictor_weight", 1.0}; + "last_seen_ad_predictor_weight", 0.0}; } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature_unittest.cc index 7514ebec9828..61ca7ad776ea 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/creative_notification_ad_model_based_predictor_feature_unittest.cc @@ -264,7 +264,7 @@ TEST(BraveAdsCreativeNotificationAdModelBasedPredictorFeatureTest, TEST(BraveAdsCreativeNotificationAdModelBasedPredictorFeatureTest, DefaultLastSeenAdPredictorWeight) { // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kNotificationAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kNotificationAdLastSeenPredictorWeight.Get()); } TEST(BraveAdsCreativeNotificationAdModelBasedPredictorFeatureTest, @@ -275,7 +275,7 @@ TEST(BraveAdsCreativeNotificationAdModelBasedPredictorFeatureTest, kCreativeNotificationAdModelBasedPredictorFeature); // Act & Assert - EXPECT_DOUBLE_EQ(1.0, kNotificationAdLastSeenPredictorWeight.Get()); + EXPECT_DOUBLE_EQ(0.0, kNotificationAdLastSeenPredictorWeight.Get()); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/input_variable/last_seen/creative_ad_model_based_predictor_last_seen_input_variable_info.h b/components/brave_ads/core/internal/serving/prediction/model_based/input_variable/last_seen/creative_ad_model_based_predictor_last_seen_input_variable_info.h index 62a8d8377e9a..e77cdd6d08c7 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/input_variable/last_seen/creative_ad_model_based_predictor_last_seen_input_variable_info.h +++ b/components/brave_ads/core/internal/serving/prediction/model_based/input_variable/last_seen/creative_ad_model_based_predictor_last_seen_input_variable_info.h @@ -18,7 +18,7 @@ struct CreativeAdModelBasedPredictorLastSeenInputVariableInfo final { // The time delta since the last time the user saw an ad. std::optional value; - double weight = 1.0; + double weight = 0.0; }; } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/scoring/creative_ad_model_based_predictor_scoring_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/scoring/creative_ad_model_based_predictor_scoring_unittest.cc index 0166ab2472e0..e5086cfa6c2f 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/scoring/creative_ad_model_based_predictor_scoring_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/scoring/creative_ad_model_based_predictor_scoring_unittest.cc @@ -46,7 +46,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorScoringTest, test::BuildCreativeAdModelBasedPredictorWeights()); // Act & Assert - EXPECT_DOUBLE_EQ(3.2916666666666665, + EXPECT_DOUBLE_EQ(3.0, ComputeCreativeAdModelBasedPredictorScore(input_variable)); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/scoring/last_seen/creative_ad_model_based_predictor_last_seen_scoring_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/scoring/last_seen/creative_ad_model_based_predictor_last_seen_scoring_unittest.cc index f1cf00000b8b..7e5dd046fac8 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/scoring/last_seen/creative_ad_model_based_predictor_last_seen_scoring_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/scoring/last_seen/creative_ad_model_based_predictor_last_seen_scoring_unittest.cc @@ -21,8 +21,7 @@ TEST(BraveAdsCreativeAdModelBasedPredictorLastSeenScoringTest, last_seen_input_variable.value = base::Hours(7); // Act & Assert - EXPECT_DOUBLE_EQ(0.29166666666666669, - ComputeLastSeenScore(last_seen_input_variable)); + EXPECT_DOUBLE_EQ(0.0, ComputeLastSeenScore(last_seen_input_variable)); } TEST(BraveAdsCreativeAdModelBasedPredictorLastSeenScoringTest, @@ -32,7 +31,7 @@ TEST(BraveAdsCreativeAdModelBasedPredictorLastSeenScoringTest, last_seen_input_variable; // Act & Assert - EXPECT_DOUBLE_EQ(1.0, ComputeLastSeenScore(last_seen_input_variable)); + EXPECT_DOUBLE_EQ(0.0, ComputeLastSeenScore(last_seen_input_variable)); } TEST(BraveAdsCreativeAdModelBasedPredictorLastSeenScoringTest, @@ -43,7 +42,7 @@ TEST(BraveAdsCreativeAdModelBasedPredictorLastSeenScoringTest, last_seen_input_variable.value = base::Days(1) + base::Milliseconds(1); // Act & Assert - EXPECT_DOUBLE_EQ(1.0, ComputeLastSeenScore(last_seen_input_variable)); + EXPECT_DOUBLE_EQ(0.0, ComputeLastSeenScore(last_seen_input_variable)); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_ad_model_based_predictor_weights_builder_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_ad_model_based_predictor_weights_builder_unittest.cc index 1a78af4c2aec..2b73f5f12ab7 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_ad_model_based_predictor_weights_builder_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_ad_model_based_predictor_weights_builder_unittest.cc @@ -36,7 +36,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 0.0; expected_weights.interest_segment.parent = 0.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } @@ -59,7 +59,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 0.0; expected_weights.interest_segment.parent = 0.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } @@ -82,7 +82,7 @@ TEST_F(BraveAdsCreativeAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 1.0; expected_weights.interest_segment.parent = 1.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_inline_content_ad_model_based_predictor_weights_builder_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_inline_content_ad_model_based_predictor_weights_builder_unittest.cc index cb801eeee718..8a37516db8ad 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_inline_content_ad_model_based_predictor_weights_builder_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_inline_content_ad_model_based_predictor_weights_builder_unittest.cc @@ -30,7 +30,7 @@ TEST_F(BraveAdsCreativeInlineContentAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 0.0; expected_weights.interest_segment.parent = 0.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_new_tab_page_ad_model_based_predictor_weights_builder_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_new_tab_page_ad_model_based_predictor_weights_builder_unittest.cc index 236fb6522326..427ce24dc225 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_new_tab_page_ad_model_based_predictor_weights_builder_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_new_tab_page_ad_model_based_predictor_weights_builder_unittest.cc @@ -30,7 +30,7 @@ TEST_F(BraveAdsCreativeNewTabPageAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 0.0; expected_weights.interest_segment.parent = 0.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_notification_ad_model_based_predictor_weights_builder_unittest.cc b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_notification_ad_model_based_predictor_weights_builder_unittest.cc index c523cdf9a50f..a44b9d7bd38f 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_notification_ad_model_based_predictor_weights_builder_unittest.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/weight/creative_notification_ad_model_based_predictor_weights_builder_unittest.cc @@ -30,7 +30,7 @@ TEST_F(BraveAdsCreativeNotificationAdModelBasedPredictorWeightsBuilderTest, expected_weights.interest_segment.child = 1.0; expected_weights.interest_segment.parent = 1.0; expected_weights.untargeted_segment = 0.0001; - expected_weights.last_seen_ad = 1.0; + expected_weights.last_seen_ad = 0.0; EXPECT_EQ(expected_weights, weights); } diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/weight/segment/creative_ad_model_based_predictor_segment_weight_unittest_util.cc b/components/brave_ads/core/internal/serving/prediction/model_based/weight/segment/creative_ad_model_based_predictor_segment_weight_unittest_util.cc index d91c0a167f20..915fa94c6205 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/weight/segment/creative_ad_model_based_predictor_segment_weight_unittest_util.cc +++ b/components/brave_ads/core/internal/serving/prediction/model_based/weight/segment/creative_ad_model_based_predictor_segment_weight_unittest_util.cc @@ -24,7 +24,7 @@ BuildCreativeAdModelBasedPredictorWeights() { weights.untargeted_segment = 0.0001; - weights.last_seen_ad = 1.0; + weights.last_seen_ad = 0.0; return weights; }