sliced.datasets.make_quadratic

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

Generates a dataset with a quadratic response curve.

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

beta = np.hstack((
    np.ones(n_informative), np.zeros(n_features - n_informative)))
h = np.dot(X, beta)
y(h) = 0.125 * h ** 2 + 0.5 * N(0, 1).

Out of the n_features features, only n_informative are actually used to compute y. The remaining features are independent of y. As such the central subspace is one dimensional and consists of the h axis.

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 n_informative.

n_informative : int, optional (default=2)

The number of informative features used to construct h. Should be at least 1.

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.