code: def data_preprocessing(
      reviews_file,
      meta_file,
      train_file,
      valid_file,
      test_file,
      user_vocab,
      item_vocab,
      cate_vocab,
      sample_rate=0.01,
      valid_num_ngs=4,
      test_num_ngs=9,
      is_history_expanding=True,
  ):
      """Create data for training, validation and testing from original dataset
  
      Args:
          reviews_file (str): Reviews dataset downloaded from former operations.
          meta_file (str): Meta dataset downloaded from former operations.
      """
      reviews_output = _reviews_preprocessing(reviews_file)
      meta_output = _meta_preprocessing(meta_file)
      instance_output = _create_instance(reviews_output, meta_output)
      _create_item2cate(instance_output)
      sampled_instance_file = _get_sampled_data(
          instance_output, sample_rate=sample_rate
      )
      preprocessed_output = _data_processing(sampled_instance_file)
      if is_history_expanding:
          _data_generating(
              preprocessed_output, train_file, valid_file, test_file
          )
      else:
          _data_generating_no_history_expanding(
              preprocessed_output, train_file, valid_file, test_file
          )
      _create_vocab(train_file, user_vocab, item_vocab, cate_vocab)
      _negative_sampling_offline(
          sampled_instance_file,
          valid_file,
          test_file,
          valid_num_ngs,
          test_num_ngs,
      )
  
imports: import os
  import shutil
  import pandas
  import gzip
  import random
  import logging
  import _pickle
  from recommenders.utils.constants import SEED
  from recommenders.datasets.download_utils import maybe_download
label_desc: Use image node_id 2 for calling a global function with example usage: data_preprocessing(reviews_file, meta_file, train_file, valid_file, test_file, user_vocab, item_vocab, cate_vocab, sample_rate, valid_num_ngs, test_num_ngs, is_history_expanding) without return types