summaryrefslogtreecommitdiff
path: root/chromium/media/learning/impl/voting_ensemble.cc
blob: ef07b1cb731909f4e601bc7e6244ef8a17b658c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/learning/impl/voting_ensemble.h"

namespace media {
namespace learning {

VotingEnsemble::VotingEnsemble(std::vector<std::unique_ptr<Model>> models)
    : models_(std::move(models)) {}

VotingEnsemble::~VotingEnsemble() = default;

TargetHistogram VotingEnsemble::PredictDistribution(
    const FeatureVector& instance) {
  TargetHistogram distribution;

  for (auto iter = models_.begin(); iter != models_.end(); iter++)
    distribution += (*iter)->PredictDistribution(instance);

  return distribution;
}

}  // namespace learning
}  // namespace media