Switch to unified view

a b/third_party/nucleus/protos/feature.proto
1
// Copyright 2019 Google LLC.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions
5
// are met:
6
//
7
// 1. Redistributions of source code must retain the above copyright notice,
8
//    this list of conditions and the following disclaimer.
9
//
10
// 2. Redistributions in binary form must reproduce the above copyright
11
//    notice, this list of conditions and the following disclaimer in the
12
//    documentation and/or other materials provided with the distribution.
13
//
14
// 3. Neither the name of the copyright holder nor the names of its
15
//    contributors may be used to endorse or promote products derived from this
16
//    software without specific prior written permission.
17
//
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
// POSSIBILITY OF SUCH DAMAGE.
29
30
// Protocol messages for describing features for machine learning model
31
// training or inference.
32
//
33
// There are three base Feature types:
34
//   - bytes
35
//   - float
36
//   - int64
37
//
38
// A Feature contains Lists which may hold zero or more values.  These
39
// lists are the base values BytesList, FloatList, Int64List.
40
//
41
// Features are organized into categories by name.  The Features message
42
// contains the mapping from name to Feature.
43
//
44
// Example Features for a movie recommendation application:
45
//   feature {
46
//     key: "age"
47
//     value { float_list {
48
//       value: 29.0
49
//     }}
50
//   }
51
//   feature {
52
//     key: "movie"
53
//     value { bytes_list {
54
//       value: "The Shawshank Redemption"
55
//       value: "Fight Club"
56
//     }}
57
//   }
58
//   feature {
59
//     key: "movie_ratings"
60
//     value { float_list {
61
//       value: 9.0
62
//       value: 9.7
63
//     }}
64
//   }
65
//   feature {
66
//     key: "suggestion"
67
//     value { bytes_list {
68
//       value: "Inception"
69
//     }}
70
//   }
71
//   feature {
72
//     key: "suggestion_purchased"
73
//     value { int64_list {
74
//       value: 1
75
//     }}
76
//   }
77
//   feature {
78
//     key: "purchase_price"
79
//     value { float_list {
80
//       value: 9.99
81
//     }}
82
//   }
83
//
84
85
syntax = "proto3";
86
option cc_enable_arenas = true;
87
option java_outer_classname = "FeatureProtos";
88
option java_multiple_files = true;
89
option java_package = "org.tensorflow.example";
90
package tensorflow;
91
92
// Containers to hold repeated fundamental values.
93
message BytesList {
94
  repeated bytes value = 1;
95
}
96
message FloatList {
97
  repeated float value = 1 [packed = true];
98
}
99
message Int64List {
100
  repeated int64 value = 1 [packed = true];
101
}
102
103
// Containers for non-sequential data.
104
message Feature {
105
  // Each feature can be exactly one kind.
106
  oneof kind {
107
    BytesList bytes_list = 1;
108
    FloatList float_list = 2;
109
    Int64List int64_list = 3;
110
  }
111
};
112
113
message Features {
114
  // Map from feature name to feature.
115
  map<string, Feature> feature = 1;
116
};
117
118
// Containers for sequential data.
119
//
120
// A FeatureList contains lists of Features.  These may hold zero or more
121
// Feature values.
122
//
123
// FeatureLists are organized into categories by name.  The FeatureLists message
124
// contains the mapping from name to FeatureList.
125
//
126
message FeatureList {
127
  repeated Feature feature = 1;
128
};
129
130
message FeatureLists {
131
  // Map from feature name to feature list.
132
  map<string, FeatureList> feature_list = 1;
133
};