summaryrefslogtreecommitdiff
path: root/chromium/media/learning/mojo/public/mojom/learning_types.mojom
blob: 22c73482e1f9d4f5105d38f8d778e1a4d4689a31 (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
36
37
38
39
40
41
42
43
44
// 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.

module media.learning.mojom;

// learning::FeatureValue (common/value.h)
struct FeatureValue {
  double value;
};

// learning::TargetValue (common/value.h)
struct TargetValue {
  double value;
};

// learning::LabelledExample (common/training_example.h)
struct LabelledExample {
  array<FeatureValue> features;
  TargetValue target_value;
};

// learning::ObservationCompletion (common/learning_task_controller.h)
struct ObservationCompletion {
  TargetValue target_value;
  uint64 weight = 1;
};

// Hack for TargetHistogram. Would ideally be a map<TargetValue, double>, but
// this causes pain in the translation to WTF::HashMap. HashMap requires
// reservations for "deleted" and "empty" sentinel values. This is especially
// undesirable in our case because TargetValue (the map key) is designed to be
// completely generic, supporting any possible value for double. We instead
// use a list of pairs (key, value) to avoid having to reserve any values as
// "empty" or "deleted".
struct TargetHistogramPair {
  TargetValue target_value;
  double count;
};

// learning::TargetHistogram (common/target_histogram.h)
struct TargetHistogram {
  array<TargetHistogramPair> pairs;
};