code: def make_P2(size_classes, random_state=None):
      """Generate the P2 Dataset:
  
      The P2 is a two-class problem, presented by Valentini[1], in which each
      class is defined in multiple decision regions delimited by polynomial
      and trigonometric functions (E1, E2, E3 and E4):
  
      .. math:: \\begin{eqnarray}
          \\label{eq:problem1}
          E1(x) = sin(x) + 5 \\\\
          \\label{eq:problem2}
          E2(x) = (x - 2)^{2} + 1 \\\\
          \\label{eq:problem3}
          E3(x) = -0.1 \\cdot x^{2} + 0.6sin(4x) + 8 \\\\
          \\label{eq:problem4}
          E4(x) = \\frac{(x - 10)^{2}}{2} + 7.902
          \\end{eqnarray}
  
      Parameters
      ----------
      size_classes : list with the number of samples for each class.
  
      random_state : int, RandomState instance or None, optional (default=None)
          If int, random_state is the seed used by the random number generator;
          If RandomState instance, random_state is the random number generator;
          If None, the random number generator is the RandomState instance used
          by `np.random`.
  
      returns
      -------
      X : array of shape = [size_classes, 2]
          The generated data points.
  
      y : array of shape = [size_classes]
          Class labels associated with each class.
  
      References
      ----------
      G. Valentini, An experimental bias-variance analysis of svm ensembles
      based on resampling techniques, IEEE Transactions on Systems, Man,
      and Cybernetics, Part B 35 (2005) 1252–1271.
  
      """
      rng = check_random_state(random_state)
      n_samples = sum(size_classes) * 6
      class_1 = np.zeros((size_classes[0], 2))
      class_2 = np.zeros((size_classes[1], 2))
      size_class1 = 0
      size_class2 = 0
      data = rng.rand(n_samples, 2)
      for x in data:
          if (size_class1 + size_class2) >= sum(size_classes):
              break
  
          # This if is very complex. Need to simplify that somehow
          if (
              x[1]
              > (
                  -0.1 * (x[0] * 10) ** 2
                  + 0.6 * np.sin(4 * x[0] * 10)
                  + 8.0
              )
              / 10.0
              and x[1] > ((x[0] * 10 - 2) ** 2 + 1) / 10
              or x[1] < (2 * np.sin(x[0] * 10) + 5) / 10
              and x[1] > ((x[0] * 10 - 2) ** 2 + 1) / 10
              or x[1]
              < (
                  -0.1 * (x[0] * 10) ** 2
                  + 0.6 * np.sin(4 * x[0] * 10)
                  + 8
              )
              / 10
              and x[1] < ((x[0] * 10 - 2) ** 2 + 1) / 10
              and x[1] > (2 * np.sin(x[0] * 10) + 5) / 10
              or x[1]
              > (
                  -0.1 * (x[0] * 10) ** 2
                  + 0.6 * np.sin(4 * x[0] * 10)
                  + 8
              )
              / 10
              and x[1] < (2 * np.sin(x[0] * 10) + 5) / 10
              or x[1] > (((x[0] * 10 - 10) ** 2) / 2 + 7.902) / 10.0
          ):
              if size_class1 < size_classes[0]:
                  class_1[size_class1] = x
                  size_class1 += 1
          elif size_class2 < size_classes[1]:
              class_2[size_class2] = x
              size_class2 += 1
  
      y = np.hstack((np.zeros(size_class1), np.ones(size_class2)))
      X = np.vstack((class_1, class_2))
  
      return X, y
  
imports: import numpy
  from sklearn.utils.validation import check_random_state
label_desc: Use image node_id 1 for calling a global function with example usage: make_P2(size_classes, random_state) and returns: X,  y