pysad.transform.projection.GaussianRandomProjector

class pysad.transform.projection.GaussianRandomProjector(num_components='auto', *, eps=0.1)[source]

Reduces dimensionality through Gaussian random projection. The components of the random matrix are drawn from N(0, 1 / n_components). This text is taken from the Sklearn documentation.

Parameters:
  • n_components (int or 'auto') –

    Dimensionality of the target projection space, optional (default = ‘auto’).

    n_components can be automatically adjusted according to the number of samples in the dataset and the bound given by the Johnson-Lindenstrauss lemma. In that case the quality of the embedding is controlled by the eps parameter.

    It should be noted that Johnson-Lindenstrauss lemma can yield very conservative estimated of the required number of components as it makes no assumption on the structure of the dataset.

  • eps (strictly positive float, optional) –

    (default=0.1) Parameter to control the quality of the embedding according to the Johnson-Lindenstrauss lemma when n_components is set to ‘auto’.

    Smaller values lead to better embedding and higher number of dimensions (n_components) in the target projection space.

Methods

__init__([num_components, eps])

Abstract base projector class to wrap the random sklearn projectors.

fit(X)

Shortcut method that iteratively applies fit_partial to all instances in order.

fit_partial(X)

Fits particular (next) timestep's features to train the projector.

fit_transform(X)

Shortcut method that iteratively applies fit_transform_partial to all instances in order.

fit_transform_partial(X)

Shortcut method that iteratively applies fit_partial and transform_partial, respectively.

transform(X)

Shortcut method that iteratively applies transform_partial to all instances in order.

transform_partial(X)

Projects particular (next) timestep's vector to (possibly) lower dimensional space.

fit(X)

Shortcut method that iteratively applies fit_partial to all instances in order.

Parameters:

X (np.float64 array of shape (num_instances, num_features)) – Input feature vectors.

Returns:

The fitted transformer

Return type:

object

fit_partial(X)

Fits particular (next) timestep’s features to train the projector.

Parameters:

X (np.float64 array of shape (num_components,)) – Input feature vector.

Returns:

self.

Return type:

object

fit_transform(X)

Shortcut method that iteratively applies fit_transform_partial to all instances in order.

Parameters:

X (np.float64 array of shape (num_instances, num_components)) – Input feature vectors.

Returns:

Projected feature vectors.

Return type:

np.float64 array of shape (num_instances, num_components)

fit_transform_partial(X)

Shortcut method that iteratively applies fit_partial and transform_partial, respectively.

Parameters:

X (np.float64 array of shape (num_components,)) – Input feature vector.

Returns:

Projected feature vector.

Return type:

transformed_X (np.float64 array of shape (num_components,))

transform(X)

Shortcut method that iteratively applies transform_partial to all instances in order.

Parameters:

X (np.float64 array of shape (num_instances, num_features)) – Input feature vectors.

Returns:

Projected feature vectors.

Return type:

np.float64 array of shape (num_instances, num_components)

transform_partial(X)

Projects particular (next) timestep’s vector to (possibly) lower dimensional space.

Parameters:

X (np.float64 array of shape (num_features,)) – Input feature vector.

Returns:

np.float64 array of shape (num_components,)

Projected feature vector.

Return type:

projected_X