Open tgrunzweig-cpacket opened 1 year ago
@tgrunzweig-cpacket, Thank you for reporting this bug. The problem is with the parquet executor exampleGen, instead of SchemaGen. The zeros are not taken up by the Parquet executor, resulting in null values in place of zeros in dataset, due to which SchemaGen reports missing values instead of zero values.
Let us debug more on this issue and we will update this thread. Thanks again!
If the bug is related to a specific library below, please raise an issue in the respective repo directly:
TensorFlow Data Validation Repo
TensorFlow Model Analysis Repo
TensorFlow Transform Repo
TensorFlow Serving Repo
System information
pip freeze
output):Describe the current behavior
Describe the expected behavior
Standalone code to reproduce the issue ` import pandas as pd import numpy as np import string import sys import tensorflow as tf from tfx import v1 as tfx from tfx.orchestration.experimental.interactive.interactive_context import InteractiveContext from google.protobuf.json_format import MessageToDict from tfx.components import FileBasedExampleGen, CsvExampleGen from tfx.components.example_gen.custom_executors import parquet_executor from tfx.dsl.components.base import executor_spec
arr_random = np.random.randint(low=0, high=3, size=(100,5)) columns = list(string.ascii_uppercase[0:5]) df = pd.DataFrame(arr_random, columns=columns) df.to_parquet('./gen_data/lots_of_zeros.parquet', index=False) _pipeline_root = './pipeline/' _data_root = './gen_data/' context = InteractiveContext(pipeline_root=_pipeline_root) custom_executor_spec = executor_spec.BeamExecutorSpec(parquet_executor.Executor) example_gen = FileBasedExampleGen(input_base=_data_root, custom_executor_spec=custom_executor_spec)
context.run(example_gen) statistics_gen = tfx.components.StatisticsGen( examples=example_gen.outputs['examples'])
context.run(statistics_gen) context.show(statistics_gen.outputs['statistics'])
` Visually inspecting this result, I find for the numeric features the following errrors:
What I think is happening is that the FileBasedExampleGen crates sparse representation of the parquet input file, and the statisticsGen interpets it as if there are no zeros in the input file.
This is in contrast to the CsvExampleGen, that for the same input (but saved as csv), has no missing values, shows the correct number of zeros, and shows the correct statistics.
Providing a bare minimum test case or step(s) to reproduce the problem will greatly help us to debug the issue. If possible, please share a link to Colab/Jupyter/any notebook.
Name of your Organization (Optional) cpacket Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.