voting_ensemble.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef MEDIA_LEARNING_IMPL_VOTING_ENSEMBLE_H_
  5. #define MEDIA_LEARNING_IMPL_VOTING_ENSEMBLE_H_
  6. #include <memory>
  7. #include <vector>
  8. #include "base/component_export.h"
  9. #include "media/learning/impl/model.h"
  10. namespace media {
  11. namespace learning {
  12. // Ensemble classifier. Takes multiple models and returns an aggregate of the
  13. // individual predictions.
  14. class COMPONENT_EXPORT(LEARNING_IMPL) VotingEnsemble : public Model {
  15. public:
  16. VotingEnsemble(std::vector<std::unique_ptr<Model>> models);
  17. VotingEnsemble(const VotingEnsemble&) = delete;
  18. VotingEnsemble& operator=(const VotingEnsemble&) = delete;
  19. ~VotingEnsemble() override;
  20. // Model
  21. TargetHistogram PredictDistribution(const FeatureVector& instance) override;
  22. private:
  23. std::vector<std::unique_ptr<Model>> models_;
  24. };
  25. } // namespace learning
  26. } // namespace media
  27. #endif // MEDIA_LEARNING_IMPL_VOTING_ENSEMBLE_H_