如何使用 Azure InferenceSchema 包为具有嵌套结构的字典生成推理模式?

How to generate Inference Schema for Dictionary with nested structure using Azure InferenceSchema package?

在 AzureML web 服务的高级评分脚本中,为了自动为我们的 web 服务生成模式,我们在构造函数中为定义的类型对象之一提供了输入 and/or 输出示例。类型和样本用于自动创建模式。 要使用模式生成,我们包括开源推理模式包版本 1.1.0 或更高版本。我能找到的类型包括 Numpy 类型、Pandas 类型、抽象参数类型。 我们如何为(通用)格式的嵌套字典定义模式:

{    "top_level_key": [
                         {"nested_key_1": "string_1",
                          "nested_key_2": <float_number>, 
                          "nested_key_3": <True/False>}
                      ]
}

我们没有很好的方法来扩展对通用 Python class 对象的处理。但是,我们计划增加对此的支持,基本上是通过提供有关必要挂钩的更多信息,并允许用户扩展基础 class 来实现挂钩以匹配所需的 class 结构。 目前支持这些类型:

pandas 麻木的 pyspark 标准 Python 对象

https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-advanced-entry-script#automatically-generate-a-swagger-schema