read_schema#

read_schema(schema: Union[str, Path, TextIOBase, DataSchema], fail_on_invalid_column=False) DataSchema#

Read and validate model schema.

Parameters
schemaUnion[str, pathlib.Path, io.TextIOBase, Dict[str, Dict[str, Any]]]

path to a schema file, file like object with schema, or a dictionary representing a schema. This method expects that provided file will be in the next yaml format:

features:

foo: <feature-type> bar: <feature-type>

additional_data:

foo: <feature-type> bar: <feature-type>

where ‘feature-type’ is one of:
  • ‘numeric’

  • ‘integer’

  • ‘categorical’

  • ‘boolean’

  • ‘text’

  • ‘array_float’

  • ‘array_float_2d’

  • ‘datetime’

Returns
DataSchema
typed dictionary with the next keys:
  • features: Dict[str, ColumnTypeValue]

  • additional_data: Dict[str, ColumnTypeValue]

where ‘ColumnTypeValue’ is one of:
  • ‘numeric’

  • ‘integer’

  • ‘categorical’

  • ‘boolean’

  • ‘text’

  • ‘array_float’

  • ‘array_float_2d’

  • ‘datetime’

fail_on_invalid_column: bool

Whether to raise exception on invalid column type or just warning