sliced.datasets.make_polynomial

sliced.datasets.make_polynomial(n_samples=500, n_features=10, random_state=None)[source]

Generates a dataset with a polynomial response curve that combines a quadratic and cubic response. There are two primary dimensions instead of one.

Inputs X are independent normally distributed features. The output y is created according to the formula:

beta1 = np.hstack((
    [1, 1, 1], np.zeros(n_features - 3)))
beta2 = np.hstack((
    [1, -1, -1], np.zeros(n_features - 3)))

u = np.dot(X, beta1)
v = np.dot(X, beta2)
y(u, v) = u + u ** 3 + v ** 2 + N(0, 1)

Out of the n_features features, only 3 are actually used to compute y. The remaining features are independent of y. As such the central subspace is two dimensional and consists of the u and v axes.

Parameters:
n_samples : int, optimal (default=500)

The number of samples.

n_features : int, optional (default=10)

The number of features. Should be at least equal to 3, the number of informative features.

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 [n_samples, n_features]

The input samples.

y : array of shape [n_samples]

The output values.