|
| 1 | +# Overview |
| 2 | + |
| 3 | +An 'entry point', is a representation of a ML.Net type in json format and it is used to serialize and deserialize an ML.Net type in JSON. |
| 4 | +It is also one of the ways ML.Net uses to deserialize experiments, and the recommended way to interface with other languages. |
| 5 | +In terms defining experiments w.r.t entry points, experiments are entry points DAGs, and respectively, entry points are experiment graph nodes. |
| 6 | +That's why through the documentaiton, we also refer to them as 'entry points nodes'. |
| 7 | +The graph 'variables', the various values of the experiemnt graph json properties serve to describe the relationship between the entry point nodes. |
| 8 | +The 'variables' are therefore the edges of the DAG. |
| 9 | + |
| 10 | +All of ML.Net entry points are described by their manifest. The manifest is another json object that documents and describes the structure of an entry points. |
| 11 | +Manifests are referenced to understand what an entry point does, and how it should be constructed, in a graph. |
| 12 | + |
| 13 | +This document briefly describes the structure of the entry points, the structure of an entry point manifest, and mentions the ML.Net classes that help construct an entry point |
| 14 | +graph. |
| 15 | + |
| 16 | +## `EntryPoint manifest - the definition of an entry point` |
| 17 | + |
| 18 | +An example of an entry point manifest object, specifically for the MissingValueIndicator transform, is: |
| 19 | + |
| 20 | +```javascript |
| 21 | + { |
| 22 | + "Name": "Transforms.MissingValueIndicator", |
| 23 | + "Desc": "Create a boolean output column with the same number of slots as the input column, where the output value is true if the value in the input column is missing.", |
| 24 | + "FriendlyName": "NA Indicator Transform", |
| 25 | + "ShortName": "NAInd", |
| 26 | + "Inputs": [ |
| 27 | + { |
| 28 | + "Name": "Column", |
| 29 | + "Type": { |
| 30 | + "Kind": "Array", |
| 31 | + "ItemType": { |
| 32 | + "Kind": "Struct", |
| 33 | + "Fields": [ |
| 34 | + { |
| 35 | + "Name": "Name", |
| 36 | + "Type": "String", |
| 37 | + "Desc": "Name of the new column", |
| 38 | + "Aliases": [ |
| 39 | + "name" |
| 40 | + ], |
| 41 | + "Required": false, |
| 42 | + "SortOrder": 150.0, |
| 43 | + "IsNullable": false, |
| 44 | + "Default": null |
| 45 | + }, |
| 46 | + { |
| 47 | + "Name": "Source", |
| 48 | + "Type": "String", |
| 49 | + "Desc": "Name of the source column", |
| 50 | + "Aliases": [ |
| 51 | + "src" |
| 52 | + ], |
| 53 | + "Required": false, |
| 54 | + "SortOrder": 150.0, |
| 55 | + "IsNullable": false, |
| 56 | + "Default": null |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + }, |
| 61 | + "Desc": "New column definition(s) (optional form: name:src)", |
| 62 | + "Aliases": [ |
| 63 | + "col" |
| 64 | + ], |
| 65 | + "Required": true, |
| 66 | + "SortOrder": 1.0, |
| 67 | + "IsNullable": false |
| 68 | + }, |
| 69 | + { |
| 70 | + "Name": "Data", |
| 71 | + "Type": "DataView", |
| 72 | + "Desc": "Input dataset", |
| 73 | + "Required": true, |
| 74 | + "SortOrder": 1.0, |
| 75 | + "IsNullable": false |
| 76 | + } |
| 77 | + ], |
| 78 | + "Outputs": [ |
| 79 | + { |
| 80 | + "Name": "OutputData", |
| 81 | + "Type": "DataView", |
| 82 | + "Desc": "Transformed dataset" |
| 83 | + }, |
| 84 | + { |
| 85 | + "Name": "Model", |
| 86 | + "Type": "TransformModel", |
| 87 | + "Desc": "Transform model" |
| 88 | + } |
| 89 | + ], |
| 90 | + "InputKind": [ |
| 91 | + "ITransformInput" |
| 92 | + ], |
| 93 | + "OutputKind": [ |
| 94 | + "ITransformOutput" |
| 95 | + ] |
| 96 | + } |
| 97 | +``` |
| 98 | + |
| 99 | +The respective entry point, constructed based on this manifest would be: |
| 100 | + |
| 101 | +```javascript |
| 102 | + { |
| 103 | + "Name": "Transforms.MissingValueIndicator", |
| 104 | + "Inputs": { |
| 105 | + "Column": [ |
| 106 | + { |
| 107 | + "Name": "Features", |
| 108 | + "Source": "Features" |
| 109 | + } |
| 110 | + ], |
| 111 | + "Data": "$data0" |
| 112 | + }, |
| 113 | + "Outputs": { |
| 114 | + "OutputData": "$Output_1528136517433", |
| 115 | + "Model": "$TransformModel_1528136517433" |
| 116 | + } |
| 117 | + } |
| 118 | +``` |
| 119 | + |
| 120 | +## `EntryPointGraph` |
| 121 | + |
| 122 | +This class encapsulates the list of nodes (`EntryPointNode`) and edges |
| 123 | +(`EntryPointVariable` inside a `RunContext`) of the graph. |
| 124 | + |
| 125 | +## `EntryPointNode` |
| 126 | + |
| 127 | +This class represents a node in the graph, and wraps an entry point call. It |
| 128 | +has methods for creating and running entry points. It also has a reference to |
| 129 | +the `RunContext` to allow it to get and set values from `EntryPointVariable`s. |
| 130 | + |
| 131 | +To express the inputs that are set through variables, a set of dictionaries |
| 132 | +are used. The `InputBindingMap` maps an input parameter name to a list of |
| 133 | +`ParameterBinding`s. The `InputMap` maps a `ParameterBinding` to a |
| 134 | +`VariableBinding`. For example, if the JSON looks like this: |
| 135 | + |
| 136 | +```javascript |
| 137 | +'foo': '$bar' |
| 138 | +``` |
| 139 | + |
| 140 | +the `InputBindingMap` will have one entry that maps the string "foo" to a list |
| 141 | +that has only one element, a `SimpleParameterBinding` with the name "foo" and |
| 142 | +the `InputMap` will map the `SimpleParameterBinding` to a |
| 143 | +`SimpleVariableBinding` with the name "bar". For a more complicated example, |
| 144 | +let's say we have this JSON: |
| 145 | + |
| 146 | +```javascript |
| 147 | +'foo': [ '$bar[3]', '$baz'] |
| 148 | +``` |
| 149 | + |
| 150 | +the `InputBindingMap` will have one entry that maps the string "foo" to a list |
| 151 | +that has two elements, an `ArrayIndexParameterBinding` with the name "foo" and |
| 152 | +index 0 and another one with index 1. The `InputMap` will map the first |
| 153 | +`ArrayIndexParameterBinding` to an `ArrayIndexVariableBinding` with name "bar" |
| 154 | +and index 3 and the second `ArrayIndexParameterBinding` to a |
| 155 | +`SimpleVariableBinding` with the name "baz". |
| 156 | + |
| 157 | +For outputs, a node assumes that an output is mapped to a variable, so the |
| 158 | +`OutputMap` is a simple dictionary from string to string. |
| 159 | + |
| 160 | +## `EntryPointVariable` |
| 161 | + |
| 162 | +This class represents an edge in the entry point graph. It has a name, a type |
| 163 | +and a value. Variables can be simple, arrays and/or dictionaries. Currently, |
| 164 | +only data views, file handles, predictor models and transform models are |
| 165 | +allowed as element types for a variable. |
| 166 | + |
| 167 | +## `RunContext` |
| 168 | + |
| 169 | +This class is just a container for all the variables in a graph. |
| 170 | + |
| 171 | +## VariableBinding and Derived Classes |
| 172 | + |
| 173 | +The abstract base class represents a "pointer to a (part of a) variable". It |
| 174 | +is used in conjunction with `ParameterBinding`s to specify inputs to an entry |
| 175 | +point node. The `SimpleVariableBinding` is a pointer to an entire variable, |
| 176 | +the `ArrayIndexVariableBinding` is a pointer to a specific index in an array |
| 177 | +variable, and the `DictionaryKeyVariableBinding` is a pointer to a specific |
| 178 | +key in a dictionary variable. |
| 179 | + |
| 180 | +## ParameterBinding and Derived Classes |
| 181 | + |
| 182 | +The abstract base class represents a "pointer to a (part of a) parameter". It |
| 183 | +parallels the `VariableBinding` hierarchy and it is used to specify the inputs |
| 184 | +to an entry point node. The `SimpleParameterBinding` is a pointer to a |
| 185 | +non-array, non-dictionary parameter, the `ArrayIndexParameterBinding` is a |
| 186 | +pointer to a specific index of an array parameter and the |
| 187 | +`DictionaryKeyParameterBinding` is a pointer to a specific key of a dictionary |
| 188 | +parameter. |
0 commit comments