Updated clang format, and restored dsd file handling that was actually broken
This commit is contained in:
@@ -382,7 +382,7 @@ namespace lms::recommendation
|
||||
FeatureNames res;
|
||||
|
||||
std::transform(std::cbegin(featureDefinitions), std::cend(featureDefinitions),
|
||||
std::inserter(res, std::begin(res)), [](auto itFeature) { return itFeature.first; });
|
||||
std::inserter(res, std::begin(res)), [](auto itFeature) { return itFeature.first; });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ namespace lms::recommendation
|
||||
|
||||
std::unordered_set<FeatureName> featureNames;
|
||||
std::transform(std::cbegin(trainSettings.featureSettingsMap), std::cend(trainSettings.featureSettingsMap), std::inserter(featureNames, std::begin(featureNames)),
|
||||
[](const auto& itFeatureSetting) { return itFeatureSetting.first; });
|
||||
[](const auto& itFeatureSetting) { return itFeatureSetting.first; });
|
||||
|
||||
const std::size_t nbDimensions{ std::accumulate(std::cbegin(featureNames), std::cend(featureNames), std::size_t{ 0 },
|
||||
[](std::size_t sum, const FeatureName& featureName) { return sum + getFeatureDef(featureName).nbDimensions; }) };
|
||||
[](std::size_t sum, const FeatureName& featureName) { return sum + getFeatureDef(featureName).nbDimensions; }) };
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Features dimension = " << nbDimensions);
|
||||
|
||||
@@ -184,8 +184,8 @@ namespace lms::recommendation
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Training network...");
|
||||
network.train(samples, trainSettings.iterationCount,
|
||||
progressCallback ? somProgressCallback : som::Network::ProgressCallback{},
|
||||
[this] { return _loadCancelled; });
|
||||
progressCallback ? somProgressCallback : som::Network::ProgressCallback{},
|
||||
[this] { return _loadCancelled; });
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Training network DONE");
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Classifying tracks...");
|
||||
@@ -242,10 +242,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
similarTrackIds.erase(std::remove_if(std::begin(similarTrackIds), std::end(similarTrackIds),
|
||||
[&](TrackId trackId) {
|
||||
return !Track::exists(session, trackId);
|
||||
}),
|
||||
std::end(similarTrackIds));
|
||||
[&](TrackId trackId) {
|
||||
return !Track::exists(session, trackId);
|
||||
}),
|
||||
std::end(similarTrackIds));
|
||||
}
|
||||
|
||||
return similarTrackIds;
|
||||
@@ -263,10 +263,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
similarReleaseIds.erase(std::remove_if(std::begin(similarReleaseIds), std::end(similarReleaseIds),
|
||||
[&](ReleaseId releaseId) {
|
||||
return !Release::exists(session, releaseId);
|
||||
}),
|
||||
std::end(similarReleaseIds));
|
||||
[&](ReleaseId releaseId) {
|
||||
return !Release::exists(session, releaseId);
|
||||
}),
|
||||
std::end(similarReleaseIds));
|
||||
}
|
||||
|
||||
return similarReleaseIds;
|
||||
@@ -302,10 +302,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
res.erase(std::remove_if(std::begin(res), std::end(res),
|
||||
[&](ArtistId artistId) {
|
||||
return !Artist::exists(session, artistId);
|
||||
}),
|
||||
std::end(res));
|
||||
[&](ArtistId artistId) {
|
||||
return !Artist::exists(session, artistId);
|
||||
}),
|
||||
std::end(res));
|
||||
}
|
||||
|
||||
while (res.size() > maxCount)
|
||||
|
||||
@@ -101,9 +101,9 @@ namespace lms::recommendation
|
||||
|
||||
template<typename IdType>
|
||||
std::vector<IdType> getSimilarObjects(const std::vector<IdType>& ids,
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const;
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const;
|
||||
|
||||
db::IDb& _db;
|
||||
bool _loadCancelled{};
|
||||
@@ -157,9 +157,9 @@ namespace lms::recommendation
|
||||
|
||||
template<typename IdType>
|
||||
std::vector<IdType> FeaturesEngine::getSimilarObjects(const std::vector<IdType>& ids,
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const
|
||||
{
|
||||
std::vector<IdType> res;
|
||||
|
||||
@@ -173,10 +173,10 @@ namespace lms::recommendation
|
||||
|
||||
// Remove objects that are already in input or already reported
|
||||
closestObjectIds.erase(std::remove_if(std::begin(closestObjectIds), std::end(closestObjectIds),
|
||||
[&](IdType id) {
|
||||
return std::find(std::cbegin(ids), std::cend(ids), id) != std::cend(ids);
|
||||
}),
|
||||
std::end(closestObjectIds));
|
||||
[&](IdType id) {
|
||||
return std::find(std::cbegin(ids), std::cend(ids), id) != std::cend(ids);
|
||||
}),
|
||||
std::end(closestObjectIds));
|
||||
|
||||
for (IdType id : closestObjectIds)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace lms::recommendation::PlaylistGeneratorConstraint
|
||||
ArtistContainer intersection;
|
||||
|
||||
std::set_intersection(std::cbegin(artists1), std::cend(artists1),
|
||||
std::cbegin(artists2), std::cend(artists2),
|
||||
std::back_inserter(intersection));
|
||||
std::cbegin(artists2), std::cend(artists2),
|
||||
std::back_inserter(intersection));
|
||||
|
||||
return intersection.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user