1 // Protocol messages for describing features for machine learning model 2 // training or inference. 3 // 4 // There are three base Feature types: 5 // - bytes 6 // - float 7 // - int64 8 // 9 // A Feature contains Lists which may hold zero or more values. These 10 // lists are the base values BytesList, FloatList, Int64List. 11 // 12 // Features are organized into categories by name. The Features message 13 // contains the mapping from name to Feature. 14 // 15 // Example Features for a movie recommendation application: 16 // feature { 17 // key: "age" 18 // value { float_list { 19 // value: 29.0 20 // }} 21 // } 22 // feature { 23 // key: "movie" 24 // value { bytes_list { 25 // value: "The Shawshank Redemption" 26 // value: "Fight Club" 27 // }} 28 // } 29 // feature { 30 // key: "movie_ratings" 31 // value { float_list { 32 // value: 9.0 33 // value: 9.7 34 // }} 35 // } 36 // feature { 37 // key: "suggestion" 38 // value { bytes_list { 39 // value: "Inception" 40 // }} 41 // } 42 // feature { 43 // key: "suggestion_purchased" 44 // value { int64_list { 45 // value: 1 46 // }} 47 // } 48 // feature { 49 // key: "purchase_price" 50 // value { float_list { 51 // value: 9.99 52 // }} 53 // } 54 // 55 56 syntax = "proto3"; 57 option cc_enable_arenas = true; 58 option java_outer_classname = "FeatureProtos"; 59 option java_multiple_files = true; 60 option java_package = "org.tensorflow.example"; 61 62 package tensorflow; 63 64 // Containers to hold repeated fundamental values. 65 message BytesList { 66 repeated bytes value = 1; 67 } 68 message FloatList { 69 repeated float value = 1 [packed = true]; 70 } 71 message Int64List { 72 repeated int64 value = 1 [packed = true]; 73 } 74 75 // Containers for non-sequential data. 76 message Feature { 77 // Each feature can be exactly one kind. 78 oneof kind { 79 BytesList bytes_list = 1; 80 FloatList float_list = 2; 81 Int64List int64_list = 3; 82 } 83 }; 84 85 message Features { 86 // Map from feature name to feature. 87 map<string, Feature> feature = 1; 88 }; 89 90 // Containers for sequential data. 91 // 92 // A FeatureList contains lists of Features. These may hold zero or more 93 // Feature values. 94 // 95 // FeatureLists are organized into categories by name. The FeatureLists message 96 // contains the mapping from name to FeatureList. 97 // 98 message FeatureList { 99 repeated Feature feature = 1; 100 }; 101 102 message FeatureLists { 103 // Map from feature name to feature list. 104 map<string, FeatureList> feature_list = 1; 105 }; 106