das.helpers.schemas package
Submodules
das.helpers.schemas.generic module
- class das.helpers.schemas.generic.ArrayFactory(array_list, title)
Bases:
objectA helper class to create array-type schema using Series objects.
Helps IoT-TICKET to map input data into correct format.
- Parameters
- array_listlist
List of Series-type objects.
- titlestr
Name for IoT-TICKET input node.
Methods
as_dict
- array_list
- as_dict()
- title
- class das.helpers.schemas.generic.ObjectFactory(object_list)
Bases:
objectA helper class to be create object-type schema using Parameters and SeriesWithKey objects.
Helps IoT-TICKET to map input data into correct format.
- Parameters
- object_listlist
List of objects of type Parameter or SeriesWithKey.
Methods
as_dict
- as_dict()
- object_list
- class das.helpers.schemas.generic.Parameter(key, title, item_type)
Bases:
objectA helper class to be used together with ObjectFactory class.
Helps IoT-TICKET to map input parameter into correct format.
- Parameters
- keystr
Key under which the parameter value is mapped to.
- titlestr
Name for IoT-TICKET input node.
- item_typestr
Type of the input data. Must be ‘number’ or ‘string’.
Methods
as_dict
- as_dict()
- item_type
- key
- title
- class das.helpers.schemas.generic.Series(length, item_type, title='Series')
Bases:
objectA helper class to be used together with ArrayFactory class.
Helps IoT-TICKET to map input series into correct format.
- Parameters
- lengthint
Length of the series; i.e. how many items will be send to service. Maximum is 10 000 set by IoT-TICKET.
- item_typestr
Type of the input data. Must be ‘number’ or ‘string’.
- titlestr
Name for IoT-TICKET input node.
Methods
as_dict
- as_dict()
- item_type
- length
- title = 'Series'
- class das.helpers.schemas.generic.SeriesWithKey(length, item_type, key='series', title='Series')
Bases:
objectA helper class to be used together with ObjectFactory class.
Helps IoT-TICKET to map input series into correct format.
- Parameters
- lengthint
Length of the series; i.e. how many items will be send to service. Maximum is 10 000 set by IoT-TICKET.
- item_type: str
Type of the input data. Must be ‘number’ or ‘string’.
- keystr
Key under which the series is mapped to.
- titlestr
Name for IoT-TICKET input node.
Methods
as_dict
- as_dict()
- item_type
- key = 'series'
- length
- title = 'Series'
das.helpers.schemas.notebook module
- class das.helpers.schemas.notebook.NotebookNode(name, type, binding_key)
Bases:
objectA helper class to be used with notebook jobs’ inputs and outputs.
- Parameters
- namestr
Name of the node.
- typestr
The type of the node. Must be one of ‘attribute_id’, ‘bool’, ‘number’, ‘string’.
- binding_keystr
The key to bind the node to an actual input or output in IoT-TICKET. For example the attribute_id value.
Examples
>>> job = DatabricksJob.from_json(job_json, credential) >>> job.notebook_inputs = [NotebookNode('input series', 'attribute_id', 'some id here')] >>> job.notebook_outputs = [NotebookNode('output series', 'attribute_id', 'some id2 here']
Methods
as_dict
- as_dict()
- binding_key
- name
- type
das.helpers.schemas.tensor module
- class das.helpers.schemas.tensor.ColSpec(key, title, item_type, length=1)
Bases:
objectA helper class to be used together with TensorInstances class.
Helps to map IoT-TICKET input data under the correct column.
- Parameters
- keystr
Name of the column to which the data is mapped.
- titlestr
Name for IoT-TICKET input node.
- item_typestr
Type of the input data. Must be one of ‘number’, ‘string’, ‘number_array’, ‘string_array’
- lengthint
Length of the item. Should be at least 2 for number and string arrays.
Methods
as_dict
- as_dict()
- item_type
- key
- length = 1
- title
- class das.helpers.schemas.tensor.ServingOutput(key='predictions', title='Predictions', item_type='number_array')
Bases:
objectServingOutput class. Defines output schema for default response format for model serving’s predict API.
Default response format is:
{ "predictions": <value>|<(nested)list>|<list-of-objects> }
See more on https://www.tensorflow.org/tfx/serving/api_rest#response_format_4
- Parameters
- keystr
Key whose value contains the predictions. Defaults to ‘predictions’.
- titlestr
Title for IoT-TICKET ml-service output for predictions.
- item_typstr
Type of the item. In the sense of default response format, the corresponding possible values are ‘number’ or ‘string’ (<value>), ‘number_array’ or ‘string_array’ (<(nested)list>) and ‘object_list’ (<list-of-objects).
Methods
as_dict
- as_dict()
- item_type = 'number_array'
- key = 'predictions'
- title = 'Predictions'
- class das.helpers.schemas.tensor.TensorInstances(columns, length=1)
Bases:
objectTensorInstances class that helps to create a schema for IoT-TICKET so it can run inference against model serving using TF serving’s “instances” format.
https://mlflow.org/docs/latest/models.html#deploy-mlflow-models https://www.tensorflow.org/tfx/serving/api_rest#specifying_input_tensors_in_row_format
- Parameters
- columnslist
List of ColSpec instances.
- lengthint
Number of instances (rows) to be used when running inference.
Methods
as_dict
- as_dict()
- columns
- length = 1