code: def choose_train_size(index_key):
      # some training vectors for PQ and the PCA
      n_train = 256 * 1000
  
      if "IVF" in index_key:
          matches = re.findall("IVF([0-9]+)", index_key)
          ncentroids = int(matches[0])
          n_train = max(n_train, 100 * ncentroids)
      elif "IMI" in index_key:
          matches = re.findall("IMI2x([0-9]+)", index_key)
          nbit = int(matches[0])
          n_train = max(n_train, 256 * (1 << nbit))
      return n_train
  
file_path: faiss/benchs/bench_polysemous_1bn.py
imports: import os
  import sys
  import time
  import numpy
  import re
  import faiss
  from multiprocessing.pool import ThreadPool
  from datasets import ivecs_read
label_desc: Use image node_id 3 for calling a global function with example usage: choose_train_size(index_key) and returns: n_train