human
2. Data Preprocessing
For data preprocessing and transformation, we use TensorFlow Transform to perform the following:
1. Implement transformation logic in preprocess_fn
2. Analyze and transform training data.
4. Transform evaluation data.
5. Save transformed data, transform schema, and transform logic.
2.1 Implement preprocess_fn
 Write me a the Python program you requested?
assistant
#Here is the Python program you requested.
def make_preprocessing_fn(raw_schema):

  def preprocessing_fn(input_features):

    processed_features = {}

    for feature in raw_schema.feature:
      feature_name = feature.name
      
      if feature_name in [TARGET_FEATURE_NAME]:
        processed_features[feature_name] = input_features[feature_name]
      elif feature.type == 1:
        # Extract vocabulary and integerize categorical features.
        processed_features[feature_name+"_integerized"] = (
            tft.compute_and_apply_vocabulary(input_features[feature_name], vocab_filename=feature_name))
      else:
        # normalize numeric features.
        processed_features[feature_name+"_scaled"] = tft.scale_to_z_score(input_features[feature_name])

    # Bucketize some of the numeric features using quantiles.
    quantiles = tft.quantiles(input_features["distance"], num_buckets=5, epsilon=0.01)
    processed_features["distance_bucketized"] = tft.apply_buckets(
      input_features["distance"], bucket_boundaries=quantiles)

    return processed_features

  return preprocessing_fn