summaryrefslogtreecommitdiff
path: root/chromium/media/learning/impl/model.h
blob: 7dd67da2eddc7c3d783b9803889bb2e97e0e83ca (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
27
28
29
30
31
32
33
34
35
// 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.

#ifndef MEDIA_LEARNING_IMPL_MODEL_H_
#define MEDIA_LEARNING_IMPL_MODEL_H_

#include "base/callback.h"
#include "base/component_export.h"
#include "media/learning/common/labelled_example.h"
#include "media/learning/common/target_histogram.h"

namespace media {
namespace learning {

// One trained model, useful for making predictions.
// TODO(liberato): Provide an API for incremental update, for those models that
// can support it.
class COMPONENT_EXPORT(LEARNING_IMPL) Model {
 public:
  // Callback for asynchronous predictions.
  using PredictionCB = base::OnceCallback<void(TargetHistogram predicted)>;

  virtual ~Model() = default;

  virtual TargetHistogram PredictDistribution(
      const FeatureVector& instance) = 0;

  // TODO(liberato): Consider adding an async prediction helper.
};

}  // namespace learning
}  // namespace media

#endif  // MEDIA_LEARNING_IMPL_MODEL_H_