Skip to main content
Version: 0.94

snorkelflow.client.nodes.add_node_hierarchy

snorkelflow.client.nodes.add_node_hierarchy(application, input_node_uid, hierarchy_config)

Initiates a hierarchical classification DAG from an initial application.

Parameters

NameTypeDefaultInfo
applicationUnion[str, int]The name or UID of the application.
input_node_uidintThe input node from where hierarchy will begin.
hierarchy_configDict[str, Dict]A dictionary config for the labels in the hierarchy.

Returns

Dict[str – Dictionary detailing nodes created in the DAG. Semantics of the output are as follows - 1. Initial_Model -> uid of the model node of the initial application 2. Label str -> Dictionary which details nodes created for the branch a. Label_Filter: uid of the LabelFilter node which segregates datapoints as per a particular label for downstream classification, b. Column_Filler: uid of the ColumnFiller node which replaces existing gts with UNK to allow new labels, c. Model: uid of the Model node which classifies these datapoints into child labels 3. Concat -> uid of the Concat node which consolidates all labels at the end

Return type

Any]

Examples

>>> sf.add_node_hierarchy(
>>> APP_NAME,
>>> model_node_uid,
>>> {
>>> "1": {"1.1": {}, "1.2": {}},
>>> "2": {"2.1": {}, "2.2": {}},
>>> }
>>> )
{
'nodes_output_dict':
{'Initial_Model': {'Model': 525},
'1': {'Label_Filter': 531, 'Column_Filler': 532, 'Model': 533},
'2': {'Label_Filter': 536, 'Column_Filler': 537, 'Model': 538},
'1.1': {'Label_Filter': 534},
'1.2': {'Label_Filter': 535},
'2.1': {'Label_Filter': 539},
'2.2': {'Label_Filter': 540},
'Concat': {'node_uid': 541, 'op_version_uid': 345}}
}