Skip to content

Commit 08dfb95

Browse files
committed
[ML] Clean shadow warnings (#46)
1 parent 4609e27 commit 08dfb95

19 files changed

+11
-45
lines changed

include/core/CStringSimilarityTester.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ class CORE_EXPORT CStringSimilarityTester : private CNonCopyable {
231231
// one go for efficiency. Then the current and previous column
232232
// pointers alternate between pointing and the first and second half
233233
// of the memory block.
234-
using TScopedSizeArray = boost::scoped_array<size_t>;
235234
TScopedSizeArray data(new size_t[(secondLen + 1) * 2]);
236235
size_t* currentCol(data.get());
237236
size_t* prevCol(currentCol + (secondLen + 1));

include/maths/CXMeansOnline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ class CXMeansOnline : public CClusterer<CVectorNx1<T, N>> {
787787
this->cluster(x, clusters, count);
788788
}
789789
} else {
790-
using TSizeDoublePr = std::pair<double, std::size_t>;
791-
using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack<TSizeDoublePr, 2, std::greater<TSizeDoublePr>>;
790+
using TDoubleSizePr = std::pair<double, std::size_t>;
791+
using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack<TDoubleSizePr, 2, std::greater<TDoubleSizePr>>;
792792

793793
TMaxAccumulator closest;
794794
for (std::size_t i = 0u; i < m_Clusters.size(); ++i) {

lib/core/unittest/CMemoryUsageTest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@ void CMemoryUsageTest::testStringClear() {
993993

994994
void CMemoryUsageTest::testSharedPointer() {
995995
LOG_DEBUG("*** testSharedPointer ***");
996-
using TIntVec = std::vector<int>;
997996
using TIntVecPtr = boost::shared_ptr<TIntVec>;
998997
using TIntVecPtrVec = std::vector<TIntVecPtr>;
999998
using TStrPtr = boost::shared_ptr<std::string>;

lib/maths/CBjkstUniqueValues.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,7 @@ void CBjkstUniqueValues::SSketch::remove(uint32_t value) {
572572
}
573573

574574
uint32_t CBjkstUniqueValues::SSketch::number() const {
575-
using TUInt32Vec = std::vector<uint32_t>;
576-
577575
// This uses the median trick to reduce the error.
578-
579576
TUInt32Vec estimates;
580577
estimates.reserve(s_Z.size());
581578
for (std::size_t i = 0u; i < s_Z.size(); ++i) {

lib/maths/COneOfNPrior.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,11 @@ bool COneOfNPrior::probabilityOfLessLikelySamples(maths_t::EProbabilityCalculati
837837
// P(m) is the prior probability the data are from the m'th model.
838838

839839
using TDoubleTailPr = std::pair<double, maths_t::ETail>;
840-
using TMaxAccumulator = CBasicStatistics::SMax<TDoubleTailPr>::TAccumulator;
840+
using TDoubleTailPrMaxAccumulator = CBasicStatistics::SMax<TDoubleTailPr>::TAccumulator;
841841

842842
TDoubleSizePr5Vec logWeights = this->normalizedLogWeights();
843843

844-
TMaxAccumulator tail_;
844+
TDoubleTailPrMaxAccumulator tail_;
845845
for (std::size_t i = 0u; i < logWeights.size(); ++i) {
846846
double weight = std::exp(logWeights[i].first);
847847
const CPrior& model = *m_Models[logWeights[i].second].second;

lib/maths/CStatisticalTests.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ void CStatisticalTests::CCramerVonMises::acceptPersistInserter(core::CStatePersi
174174
}
175175

176176
void CStatisticalTests::CCramerVonMises::addF(double f) {
177-
using TDoubleVec = std::vector<double>;
178-
179177
if (m_F.size() == m_Size) {
180178
TDoubleVec ff;
181179
ff.reserve(m_F.size() + 1);

lib/maths/unittest/CKMeansFastTest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ void CKMeansFastTest::testClosestPoints() {
369369
// Check the obvious invariant that the closest point to each
370370
// centre is closer to that centre than any other.
371371

372-
using TVector2VecVec = std::vector<TVector2Vec>;
373372
using TVector4VecVec = std::vector<TVector4Vec>;
374373

375374
test::CRandomNumbers rng;

lib/maths/unittest/CMultimodalPriorTest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ void CMultimodalPriorTest::testPropagation() {
181181
// mean and the marginal likelihood confidence intervals increase
182182
// (due to influence of the prior uncertainty) after propagation.
183183

184-
using TDoubleDoublePr = std::pair<double, double>;
185-
186184
double eps = 0.01;
187185

188186
test::CRandomNumbers rng;

lib/maths/unittest/CMultivariateMultimodalPriorTest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ void CMultivariateMultimodalPriorTest::testSplitAndMerge() {
388388

389389
// Test clustering which changes over time.
390390

391-
using TDoubleVecVecVec = std::vector<TDoubleVecVec>;
392-
393391
maths::CSampling::seed();
394392

395393
test::CRandomNumbers rng;

lib/maths/unittest/CMultivariateOneOfNPriorTest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ void CMultivariateOneOfNPriorTest::testMarginalLikelihoodMean() {
637637

638638
using TSizeVec = std::vector<std::size_t>;
639639
using TSizeVecVec = std::vector<TSizeVec>;
640-
using TMeanAccumulator = maths::CBasicStatistics::SSampleMean<double>::TAccumulator;
641640
using TMean2Accumulator = maths::CBasicStatistics::SSampleMean<TVector2>::TAccumulator;
642641

643642
maths::CSampling::seed();

lib/maths/unittest/COrdinalTest.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ void COrdinalTest::testLess() {
178178
CPPUNIT_ASSERT(s1[i] < s1[j]);
179179
}
180180
}
181+
181182
CPPUNIT_ASSERT(s1[2] < s2[1]);
182-
CPPUNIT_ASSERT(!(s1[3] < s2[0]));
183+
CPPUNIT_ASSERT(!(s2[1] < s1[2]));
183184
CPPUNIT_ASSERT(s2[0] < s1[3]);
184-
CPPUNIT_ASSERT(!(s2[3] < s1[0]));
185+
CPPUNIT_ASSERT(!(s1[3] < s2[0]));
185186
}
186187

187188
void COrdinalTest::testIsNan() {

lib/maths/unittest/CRandomProjectionClustererTest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ void CRandomProjectionClustererTest::testNeighbourhoods() {
256256
// isn't perfect because we don't store the full points so are
257257
// computing distances projections.
258258

259-
using TVector = maths::CVector<double>;
260259
using TVectorVec = std::vector<TVector>;
261260

262261
test::CRandomNumbers rng;

lib/maths/unittest/CXMeansTest.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ void CXMeansTest::testCluster() {
126126

127127
// Test basic accessors and checksum functionality of cluster.
128128

129-
using TDoubleVec = std::vector<double>;
130-
131129
maths::CSampling::seed();
132130

133131
test::CRandomNumbers rng;
@@ -193,8 +191,6 @@ void CXMeansTest::testImproveStructure() {
193191

194192
// Test improve structure finds an obvious split of the data.
195193

196-
using TMeanAccumulator = maths::CBasicStatistics::SSampleMean<double>::TAccumulator;
197-
198194
maths::CSampling::seed();
199195

200196
double means[][2] = {{10.0, 20.0}, {50.0, 30.0}};

lib/model/CAnomalyDetectorModelConfig.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ bool CAnomalyDetectorModelConfig::configureModelPlot(const boost::property_tree:
424424
try {
425425
std::string valueStr(propTree.get<std::string>(TERMS_PROPERTY));
426426

427-
using TStrVec = core::CStringUtils::TStrVec;
428427
TStrVec tokens;
429428
std::string remainder;
430429
core::CStringUtils::tokenise(",", valueStr, tokens, remainder);
@@ -744,8 +743,6 @@ const std::string PER_PARTITION_NORMALIZATION_PROPERTY("perPartitionNormalizatio
744743
}
745744

746745
bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptree& propertyTree) {
747-
using TStrVec = std::vector<std::string>;
748-
749746
bool result = true;
750747

751748
for (const auto& property : propertyTree) {

lib/model/CEventRateBucketGatherer.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,6 @@ bool restoreUniqueStrings(core::CStateRestoreTraverser& traverser, CUniqueString
598598
//! Persist influencer collections of unique strings.
599599
void persistInfluencerUniqueStrings(const CUniqueStringFeatureData::TStoredStringPtrWordSetUMap& map,
600600
core::CStatePersistInserter& inserter) {
601-
using TStoredStringPtrVec = std::vector<core::CStoredStringPtr>;
602-
603601
if (!map.empty()) {
604602
// Order the map keys to ensure consistent persistence
605603
TStoredStringPtrVec keys;

lib/model/CHierarchicalResultsAggregator.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ void CHierarchicalResultsAggregator::detectorProbabilities(const TNode& node,
296296
int& detector,
297297
int& aggregation,
298298
TDouble1Vec& probabilities) {
299-
using TDouble1Vec = core::CSmallVector<double, 1>;
300299
using TIntDouble1VecFMap = boost::container::flat_map<int, TDouble1Vec>;
301300

302301
int fallback{static_cast<int>(model_t::E_AggregatePeople)};

lib/model/unittest/CEventRateAnomalyDetectorTest.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ void importData(ml::core_t::TTime firstTime,
121121
ml::model::CAnomalyDetector& detector) {
122122
using TifstreamPtr = boost::shared_ptr<std::ifstream>;
123123
using TifstreamPtrVec = std::vector<TifstreamPtr>;
124-
using TTimeVec = std::vector<ml::core_t::TTime>;
125124

126125
TifstreamPtrVec ifss;
127126
for (std::size_t i = 0u; i < fileNames.size(); ++i) {

lib/model/unittest/CMetricModelTest.cc

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,6 @@ void CMetricModelTest::testMultivariateSample() {
665665
void CMetricModelTest::testProbabilityCalculationForMetric() {
666666
LOG_DEBUG("*** testProbabilityCalculationForMetric ***");
667667

668-
using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap<TDoubleSizePr>;
669-
670668
core_t::TTime startTime(0);
671669
core_t::TTime bucketLength(10);
672670
SModelParams params(bucketLength);
@@ -689,8 +687,7 @@ void CMetricModelTest::testProbabilityCalculationForMetric() {
689687
CMetricModel& model = static_cast<CMetricModel&>(*model_.get());
690688
CPPUNIT_ASSERT_EQUAL(std::size_t(0), addPerson("p", gatherer, m_ResourceMonitor));
691689

692-
TMinAccumulator minProbabilities(2u);
693-
690+
maths::CBasicStatistics::COrderStatisticsHeap<TDoubleSizePr> minProbabilities(2u);
694691
test::CRandomNumbers rng;
695692

696693
core_t::TTime time = startTime;
@@ -730,8 +727,6 @@ void CMetricModelTest::testProbabilityCalculationForMetric() {
730727
void CMetricModelTest::testProbabilityCalculationForMedian() {
731728
LOG_DEBUG("*** testProbabilityCalculationForMedian ***");
732729

733-
using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap<TDoubleSizePr>;
734-
735730
core_t::TTime startTime(0);
736731
core_t::TTime bucketLength(10);
737732
SModelParams params(bucketLength);
@@ -750,8 +745,7 @@ void CMetricModelTest::testProbabilityCalculationForMedian() {
750745
CMetricModel& model = static_cast<CMetricModel&>(*model_.get());
751746
CPPUNIT_ASSERT_EQUAL(std::size_t(0), addPerson("p", gatherer, m_ResourceMonitor));
752747

753-
TMinAccumulator minProbabilities(2u);
754-
748+
maths::CBasicStatistics::COrderStatisticsHeap<TDoubleSizePr> minProbabilities(2u);
755749
test::CRandomNumbers rng;
756750

757751
core_t::TTime time = startTime;
@@ -1048,8 +1042,6 @@ void CMetricModelTest::testProbabilityCalculationForLatLong() {
10481042
void CMetricModelTest::testInfluence() {
10491043
LOG_DEBUG("*** testInfluence ***");
10501044

1051-
using TMinAccumulator = maths::CBasicStatistics::SMin<TDoubleStrPr>::TAccumulator;
1052-
using TMaxAccumulator = maths::CBasicStatistics::SMax<TDoubleStrPr>::TAccumulator;
10531045
using TStrDoubleDoubleTr = core::CTriple<std::string, double, double>;
10541046
using TStrDoubleDoubleTrVec = std::vector<TStrDoubleDoubleTr>;
10551047
using TStrDoubleDoubleTrVecVec = std::vector<TStrDoubleDoubleTrVec>;
@@ -1087,8 +1079,8 @@ void CMetricModelTest::testInfluence() {
10871079
TDoubleVec samples;
10881080
rng.generateNormalSamples(mean, variance, bucketCount, samples);
10891081

1090-
TMinAccumulator min;
1091-
TMaxAccumulator max;
1082+
maths::CBasicStatistics::SMin<TDoubleStrPr>::TAccumulator min;
1083+
maths::CBasicStatistics::SMax<TDoubleStrPr>::TAccumulator max;
10921084
for (std::size_t j = 0u; j < samples.size(); ++j) {
10931085
addArrival(*gatherer, m_ResourceMonitor, time, "p", samples[j], TOptionalStr(influencerValues[j]));
10941086
min.add(TDoubleStrPr(samples[j], influencerValues[j]));

lib/model/unittest/CMetricPopulationDataGathererTest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ void CMetricPopulationDataGathererTest::testRemovePeople() {
600600
// people are removed.
601601

602602
using TSizeVec = std::vector<std::size_t>;
603-
using TStrVec = std::vector<std::string>;
604603
using TSizeUInt64Pr = std::pair<std::size_t, uint64_t>;
605604
using TSizeUInt64PrVec = std::vector<TSizeUInt64Pr>;
606605
using TStrFeatureDataPr = std::pair<std::string, SMetricFeatureData>;
@@ -746,7 +745,6 @@ void CMetricPopulationDataGathererTest::testRemoveAttributes() {
746745
// attributes are removed.
747746

748747
using TSizeVec = std::vector<std::size_t>;
749-
using TStrVec = std::vector<std::string>;
750748
using TStrFeatureDataPr = std::pair<std::string, SMetricFeatureData>;
751749
using TStrFeatureDataPrVec = std::vector<TStrFeatureDataPr>;
752750

0 commit comments

Comments
 (0)