#include "components/segmentation_platform/internal/post_processor/post_processor.h"
#include "components/segmentation_platform/internal/metadata/metadata_utils.h"
#include "components/segmentation_platform/internal/metadata/metadata_writer.h"
#include "components/segmentation_platform/public/proto/model_metadata.pb.h"
#include "components/segmentation_platform/public/result.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace segmentation_platform {
namespace {
const char kNotShowShare[] = …;
const char kShowShare[] = …;
const int kShowShareTTL = …;
const int kDefaultTTL = …;
const char kNewTabUser[] = …;
const char kShareUser[] = …;
const char kShoppingUser[] = …;
const char kVoiceUser[] = …;
const int kNewTabUserTTL = …;
const int kShareUserTTL = …;
const int kShoppingUserTTL = …;
const int kVoiceUserTTL = …;
const char kLowUsed[] = …;
const char kMediumUsed[] = …;
const char kHighUsed[] = …;
const char kUnderflowLabel[] = …;
proto::OutputConfig GetTestOutputConfigForBinaryClassifier() { … }
proto::OutputConfig GetTestOutputConfigForMultiClassClassifier(
int top_k_outputs,
std::optional<float> threshold) { … }
proto::OutputConfig GetTestOutputConfigForMultiClassClassifier(
int top_k_outputs,
const base::span<float> per_class_thresholds) { … }
proto::OutputConfig GetTestOutputConfigForBinnedClassifier() { … }
proto::OutputConfig GetTestOutputConfigForGenericClassifier() { … }
}
TEST(PostProcessorTest, BinaryClassifierScoreGreaterThanThreshold) { … }
TEST(PostProcessorTest, BinaryClassifierScoreGreaterEqualToThreshold) { … }
TEST(PostProcessorTest, BinaryClassifierScoreGreaterLessThanThreshold) { … }
TEST(PostProcessorTest, MultiClassClassifierWithTopKLessThanElements) { … }
TEST(PostProcessorTest, MultiClassClassifierWithTopKEqualToElements) { … }
TEST(PostProcessorTest, MultiClassClassifierWithThresholdBetweenModelResult) { … }
TEST(PostProcessorTest,
MultiClassClassifierWithThresholdGreaterThanModelResult) { … }
TEST(PostProcessorTest,
MultiClassClassifierWithThresholdLesserThanModelResult) { … }
TEST(PostProcessorTest, MultiClassClassifierWithPerClassThresholds) { … }
TEST(PostProcessorTest, BinnedClassifierScoreGreaterThanHighUserThreshold) { … }
TEST(PostProcessorTest, BinnedClassifierScoreGreaterThanMediumUserThreshold) { … }
TEST(PostProcessorTest, BinnedClassifierScoreGreaterThanLowUserThreshold) { … }
TEST(PostProcessorTest, BinnedClassifierScoreEqualToLowUserThreshold) { … }
TEST(PostProcessorTest, BinnedClassifierScoreLessThanLowUserThreshold) { … }
TEST(PostProcessorTest,
GetPostProcessedClassificationResultWithEmptyPredResult) { … }
TEST(PostProcessorTest,
GetPostProcessedClassificationResultWithNonEmptyPredResult) { … }
TEST(PostProcessorTest, GetTTLWhenLabelTTLPresentInMap) { … }
TEST(PostProcessorTest, GetTTLWhenLabelTTLNotPresentInMap) { … }
TEST(PostProcessorTest, GetTTLForMultiClassWithNoLabels) { … }
TEST(PostProcessorTest, GetRawResult) { … }
TEST(PostProcessorTest, IsClassificationModel) { … }
TEST(PostProcessorTest, BinaryConfigMissingLabel) { … }
TEST(PostProcessorTest, MultiClassClassifierMissingLabels) { … }
TEST(PostProcessorTest, MultiClassClassifierExtraScore) { … }
TEST(PostProcessorTest, BinnedClassifier) { … }
}