C2W2 - Issues trying to configure TFX Components (ExampleGen, StatsGen, SchemaGen)

Hi,
I’m having some issues trying to set up the initial TFX Components. When trying to run the ExampleValidator I get an error with the following code:
example_validator = tfx.components.ExampleValidator(statistics=statistics_gen.outputs[‘statistics’],
schema=schema_gen.outputs[‘result’])
KeyError: ‘result’
I noticed that the SchemaGen does not have any input or output artifacts, and that the StatsGen does not produce an output artifact (though it takes an artifact of type Example). My code for the StatsGen is:

statistics_gen = tfx.components.StatisticsGen(example_gen.outputs[‘examples’])
statistics_gen

The code for SchemaGen is similar.
When trying to use context.show() for both, no visualisation is shown. I noticed after creating the get_records fn, that the bytesList features returned strange values, i.e. ‘‘date_time’: {‘bytesList’: {‘value’: [‘MjAxMi0xMC0wMiAwOTowMDowMA==’]}}’ - is this the cause of this issue?

I’ve had a look at some of the TF documentation and not sure what I’m doing wrong, and I can’t find much info on these early components in the course notes.

TIA

When creating ExampleValidator, you should be looking for schema inside schema_gen.outputs and not for result.

When creating SchemaGen, use the correct key under statistics_gen.outputs and not examples_gen.

Here are the steps:

  1. Create statistics
  2. Use statistics to infer schema
  3. Use schema and statistics to initialize validator.

Thanks, I can now run the example validator without error, however I’m not sure if this is the correct output:

Is this to be expected?

You output doesn’t look right.

It should look something like this:

Ok I realized what I did wrong - I wasn’t running the components using the interactive context (e.g. example_validator instead of context.run(example_validator)). Thanks again, I now have the same output that you provided.