voting_ensemble.cc 738 B

1234567891011121314151617181920212223242526
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "media/learning/impl/voting_ensemble.h"
  5. namespace media {
  6. namespace learning {
  7. VotingEnsemble::VotingEnsemble(std::vector<std::unique_ptr<Model>> models)
  8. : models_(std::move(models)) {}
  9. VotingEnsemble::~VotingEnsemble() = default;
  10. TargetHistogram VotingEnsemble::PredictDistribution(
  11. const FeatureVector& instance) {
  12. TargetHistogram distribution;
  13. for (auto iter = models_.begin(); iter != models_.end(); iter++)
  14. distribution += (*iter)->PredictDistribution(instance);
  15. return distribution;
  16. }
  17. } // namespace learning
  18. } // namespace media