如何在训练数据中随机添加零值噪声?

How to add randomly noise with zero value in training data?

    gt_array = [38.28,   236.86,    96.498,  187.41,   125.21,   131.59,   154.72,    78.156,
  198.58,    42.268,  121.22,   145.94,   157.11,   106.07,   196.98,    98.891,
  236.06,    94.903,  115.64,   177.05,   157.91,   157.11,   186.62,   147.54,
  224.9,    145.94,   115.64,   202.57,   161.1,    189.81,   189.81,   185.02,
  224.9,   183.43,   112.45,   228.88,   153.12,   236.86,   180.24,   241.64,
  204.96,   245.63]

我有这个训练数据。我想在训练中为某些数据添加零值以获得更好的去噪模型。 我知道这样的:

noise_factor = 0.5
    input_noisy = gt_array + noise_factor * np.random.normal(loc = 0.0, scale = 1.0 , size = gt_array.shape)

但我想在训练数据中随机获得零噪声?我怎样才能做到这一点?

Use random choice to get a set of indices based on the proportion and finally set those to 0.

zero_noise_proportion = 0.3 # 30% of the data
indices = np.random.choice(np.arange(gt_array.size), 
                           replace=False, 
                           size=int(gt_array.size * zero_noise_proportion))
gt_array[indices] = 0