summaryrefslogtreecommitdiff
path: root/chromium/media/learning/impl/voting_ensemble.cc
blob: ec29cf5d1da0c032fa7b2d742abdf0cba6efa930 (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
// 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