code: def toy_logistic_data(
      num_examples, input_size=2, weights_prior_stddev=5.0
  ):
      """Generates synthetic data for binary classification.
  
      Args:
        num_examples: The number of samples to generate (scalar Python `int`).
        input_size: The input space dimension (scalar Python `int`).
        weights_prior_stddev: The prior standard deviation of the weight
            vector. (scalar Python `float`).
  
      Returns:
        random_weights: Sampled weights as a Numpy `array` of shape
            `[input_size]`.
        random_bias: Sampled bias as a scalar Python `float`.
        design_matrix: Points sampled uniformly from the cube `[-1,
            1]^{input_size}`, as a Numpy `array` of shape `(num_examples,
            input_size)`.
        labels: Labels sampled from the logistic model `p(label=1) =
            logistic(dot(features, random_weights) + random_bias)`, as a Numpy
            `int32` `array` of shape `(num_examples, 1)`.
      """
      random_weights = weights_prior_stddev * np.random.randn(
          input_size
      )
      random_bias = np.random.randn()
      design_matrix = np.random.rand(num_examples, input_size) * 2 - 1
      logits = np.reshape(
          np.dot(design_matrix, random_weights) + random_bias, (-1, 1)
      )
      p_labels = 1.0 / (1 + np.exp(-logits))
      labels = np.int32(p_labels > np.random.rand(num_examples, 1))
      return (
          random_weights,
          random_bias,
          np.float32(design_matrix),
          labels,
      )
  
file_path: probability/tensorflow_probability/examples/logistic_regression.py
imports: import os
  from absl import app
  from absl import flags
  from matplotlib import cm
  from matplotlib import figure
  from matplotlib.backends import backend_agg
  import numpy
  import tensorflow.compat.v2
  import tensorflow_probability
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 2 for calling a global function with example usage: toy_logistic_data(num_examples, input_size, weights_prior_stddev) and returns: random_weights,  random_bias,  np,  labels