Skip to content

Commit c3e9089

Browse files
committed
fix merge errors
1 parent 3cda9ce commit c3e9089

6 files changed

+45
-57
lines changed

lib/model/unittest/CDetectionRuleTest.cc

+33-34
Original file line numberDiff line numberDiff line change
@@ -794,40 +794,39 @@ BOOST_FIXTURE_TEST_CASE(testRuleActions, CTestFixture) {
794794
0, 0, 100));
795795
}
796796

797-
TMockModelPtr initializeModel(ml::model::CResourceMonitor& resourceMonitor) {
798-
core_t::TTime bucketLength{600};
799-
model::SModelParams params{bucketLength};
800-
model::CSearchKey key;
801-
model_t::TFeatureVec features;
802-
// Initialize mock model
803-
model::CAnomalyDetectorModel::TDataGathererPtr gatherer;
804-
805-
features.assign(1, model_t::E_IndividualSumByBucketAndPerson);
806-
807-
gatherer = std::make_shared<model::CDataGatherer>(
808-
model_t::analysisCategory(features[0]), model_t::E_None, params, EMPTY_STRING,
809-
EMPTY_STRING, "p", EMPTY_STRING, EMPTY_STRING, TStrVec{}, key, features, 0, 0);
810-
811-
std::string person("p1");
812-
bool addedPerson{false};
813-
gatherer->addPerson(person, resourceMonitor, addedPerson);
814-
815-
TMockModelPtr model{new model::CMockModel(
816-
params, gatherer, {/* we don't care about influence */})};
817-
818-
maths::time_series::CTimeSeriesDecomposition trend;
819-
maths::common::CNormalMeanPrecConjugate prior{
820-
maths::common::CNormalMeanPrecConjugate::nonInformativePrior(maths_t::E_ContinuousData)};
821-
maths::common::CModelParams timeSeriesModelParams{
822-
bucketLength, 1.0, 0.001, 0.2, 6 * core::constants::HOUR, 24 * core::constants::HOUR};
823-
std::unique_ptr<maths::time_series::CUnivariateTimeSeriesModel> timeSeriesModel =
824-
std::make_unique<maths::time_series::CUnivariateTimeSeriesModel>(
825-
timeSeriesModelParams, 0, trend, prior);
826-
model::CMockModel::TMathsModelUPtrVec models;
827-
models.emplace_back(std::move(timeSeriesModel));
828-
model->mockTimeSeriesModels(std::move(models));
829-
return model;
830-
}
797+
// TMockModelPtr initializeModel(ml::model::CResourceMonitor& resourceMonitor) {
798+
// core_t::TTime bucketLength{600};
799+
// model::SModelParams params{bucketLength};
800+
// model::CSearchKey key;
801+
// model_t::TFeatureVec features;
802+
// // Initialize mock model
803+
// model::CAnomalyDetectorModel::TDataGathererPtr gatherer;
804+
//
805+
// features.assign(1, model_t::E_IndividualSumByBucketAndPerson);
806+
//
807+
// gatherer = CDataGathererBuilder(model_t::analysisCategory(features[0]), features, params, key, 0)
808+
// .personFieldName("p")
809+
// .buildSharedPtr();
810+
// std::string person("p1");
811+
// bool addedPerson{false};
812+
// gatherer->addPerson(person, resourceMonitor, addedPerson);
813+
//
814+
// TMockModelPtr model{new model::CMockModel(
815+
// params, gatherer, {/* we don't care about influence */})};
816+
//
817+
// maths::time_series::CTimeSeriesDecomposition trend;
818+
// maths::common::CNormalMeanPrecConjugate prior{
819+
// maths::common::CNormalMeanPrecConjugate::nonInformativePrior(maths_t::E_ContinuousData)};
820+
// maths::common::CModelParams timeSeriesModelParams{
821+
// bucketLength, 1.0, 0.001, 0.2, 6 * core::constants::HOUR, 24 * core::constants::HOUR};
822+
// std::unique_ptr<maths::time_series::CUnivariateTimeSeriesModel> timeSeriesModel =
823+
// std::make_unique<maths::time_series::CUnivariateTimeSeriesModel>(
824+
// timeSeriesModelParams, 0, trend, prior);
825+
// model::CMockModel::TMathsModelUPtrVec models;
826+
// models.emplace_back(std::move(timeSeriesModel));
827+
// model->mockTimeSeriesModels(std::move(models));
828+
// return model;
829+
// }
831830

832831
BOOST_FIXTURE_TEST_CASE(testRuleTimeShiftShouldShiftTimeSeriesModelState, CTestFixture) {
833832

lib/model/unittest/CEventRateDataGathererTest.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ BOOST_FIXTURE_TEST_CASE(testSingleSeriesOutOfOrderFinalResult, CTestFixture) {
834834
};
835835

836836
const std::array expectedPersonCounts = {
837-
constexpr std::array expectedPersonCounts = {
838837
std::string("[(0, 6)]"), std::string("[(0, 3)]"), std::string("[(0, 2)]"),
839838
std::string("[(0, 0)]"), std::string("[(0, 3)]")};
840839

@@ -1489,7 +1488,7 @@ class CDistinctStringsTestFixture : public CTestFixture {
14891488

14901489
SEventRateFeatureData featureData(0);
14911490
data.populateDistinctCountFeatureData(featureData);
1492-
std::ranges::sort(featureData.s_InfluenceValues[0],
1491+
std::sort(featureData.s_InfluenceValues[0].begin(), featureData.s_InfluenceValues[0].end(),
14931492
maths::common::COrderings::SFirstLess());
14941493
BOOST_REQUIRE_EQUAL(std::string("3, [[(inf1, ([2], 1)), (inf2, ([2], 1)), (inf3, ([1], 1))]]"),
14951494
featureData.print());
@@ -1523,7 +1522,7 @@ class CDistinctStringsTestFixture : public CTestFixture {
15231522
SEventRateFeatureData featureData(0);
15241523
data.populateDistinctCountFeatureData(featureData);
15251524
for (std::size_t i = 0; i < 2; i++) {
1526-
std::ranges::sort(featureData.s_InfluenceValues[i],
1525+
std::sort(featureData.s_InfluenceValues[i].begin(), featureData.s_InfluenceValues[i].end(),
15271526
maths::common::COrderings::SFirstLess());
15281527
}
15291528
BOOST_REQUIRE_EQUAL(std::string("3, [[(inf1, ([2], 1)), (inf2, ([2], 1))], [(inf_v2, ([1], 1)), (inf_v3, ([2], 1))]]"),
@@ -1619,7 +1618,7 @@ class CDistinctStringsTestFixture : public CTestFixture {
16191618
SEventRateFeatureData featureData(0);
16201619
data.populateInfoContentFeatureData(featureData);
16211620
for (std::size_t i = 0; i < 2; i++) {
1622-
std::ranges::sort(featureData.s_InfluenceValues[i],
1621+
std::sort(featureData.s_InfluenceValues[i].begin(), featureData.s_InfluenceValues[i].end(),
16231622
maths::common::COrderings::SFirstLess());
16241623
}
16251624
BOOST_REQUIRE_EQUAL(std::string("18, [[(inf1, ([16], 1)), (inf2, ([16], 1))], [(inf_v2, ([12], 1)), (inf_v3, ([16], 1))]]"),

lib/model/unittest/CEventRatePopulationDataGathererTest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ BOOST_FIXTURE_TEST_CASE(testCompressedLength, CTestFixture) {
475475

476476
CDataGatherer::TFeatureVec features;
477477
features.push_back(model_t::E_PopulationInfoContentByBucketPersonAndAttribute);
478-
SModelParams constparams(bucketLength);
478+
SModelParams const params(bucketLength);
479479
CDataGatherer dataGatherer = CDataGathererBuilder(model_t::E_PopulationEventRate,
480480
features, params, searchKey, startTime)
481481
.valueFieldName("value")

lib/model/unittest/CHierarchicalResultsTest.cc

+5-6
Original file line numberDiff line numberDiff line change
@@ -1447,12 +1447,11 @@ BOOST_AUTO_TEST_CASE(testWriter) {
14471447
auto interimBucketCorrector =
14481448
std::make_shared<model::CInterimBucketCorrector>(modelConfig.bucketLength());
14491449
model::CSearchKey key;
1450-
model::CAnomalyDetectorModel::TDataGathererPtr dataGatherer(
1451-
std::make_shared<model::CDataGatherer>(
1452-
model_t::E_EventRate, model_t::E_None, params, EMPTY_STRING,
1453-
EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, TStrVec{}, key,
1454-
model_t::TFeatureVec{model_t::E_IndividualCountByBucketAndPerson},
1455-
modelConfig.bucketLength(), 0));
1450+
auto dataGatherer =
1451+
model::CDataGathererBuilder(model_t::E_EventRate,
1452+
{model_t::E_IndividualCountByBucketAndPerson},
1453+
params, key, modelConfig.bucketLength())
1454+
.buildSharedPtr();
14561455
model::CEventData dummy;
14571456
dataGatherer->addArrival(TStrCPtrVec(1, &EMPTY_STRING), dummy, resourceMonitor);
14581457
dummy.clear();

lib/model/unittest/CMetricDataGathererTest.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1607,9 +1607,9 @@ BOOST_FIXTURE_TEST_CASE(testMultivariate, CTestFixture) {
16071607
{
16081608
TFeatureVec features;
16091609
features.push_back(model_t::E_IndividualMeanLatLongByPerson);
1610-
CDataGatherer gatherer(model_t::E_Metric, model_t::E_None, params,
1611-
EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING,
1612-
EMPTY_STRING, {}, KEY, features, startTime, 0);
1610+
CDataGatherer gatherer = CDataGathererBuilder(model_t::E_Metric, features,
1611+
params, KEY, startTime)
1612+
.build();
16131613
BOOST_REQUIRE_EQUAL(0, addPerson("p", gatherer, m_ResourceMonitor));
16141614

16151615
TTimeDoubleDoubleTupleVecVec buckets;

lib/model/unittest/ModelTestHelpers.h

-9
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,6 @@ class CDataGathererBuilder {
110110
m_PartitionFieldValue, m_SearchKey, m_Features,
111111
bucketGathererInitData};
112112
}
113-
114-
std::shared_ptr<CDataGatherer> buildSharedPtr() const {
115-
return std::make_shared<CDataGatherer>(
116-
m_GathererType, m_SummaryMode, m_Params, m_SummaryCountFieldName,
117-
m_PartitionFieldValue, m_PersonFieldName, m_AttributeFieldName,
118-
m_ValueFieldName, m_InfluenceFieldNames, m_SearchKey, m_Features,
119-
m_StartTime, m_SampleCountOverride);
120-
}
121-
122113
CDataGathererBuilder& partitionFieldValue(std::string_view partitionFieldValue) {
123114
m_PartitionFieldValue = partitionFieldValue;
124115
return *this;

0 commit comments

Comments
 (0)