dSalmon.projection

Feature projectors.

Classes

LODAProjector(n_projections[, float_type, seed])

Sparse random projections as used for by LODA [Pevny16].

StreamHash(n_projections[, float_type, seed])

Random projections for feature-evolving streams as used by xStream [MLA18].

class dSalmon.projection.LODAProjector(n_projections, float_type=<class 'numpy.float64'>, seed=0)[source]

Sparse random projections as used for by LODA [Pevny16].

Parameters
  • n_projections (int) – The dimension of the projected data.

  • float_type (np.float32 or np.float64) – The floating point type to use for internal processing.

  • seed (int) – Random seed for projection.

transform(X)[source]

Perform projection of a block of data. Order of rows in X is not important.

Parameters

X (ndarray, shape (n_samples, n_features)) – The input data.

Returns

X_tr – The projected data.

Return type

ndarray, shape (n_samples, n_features)

class dSalmon.projection.StreamHash(n_projections, float_type=<class 'numpy.float64'>, seed=0)[source]

Random projections for feature-evolving streams as used by xStream [MLA18].

Parameters
  • n_projections (int) – The dimension of the projected data.

  • float_type (np.float32 or np.float64) – The floating point type to use for internal processing.

  • seed (int) – Random seed for projection.

transform(X, features=None)[source]

Perform projection of a block of data. Order of rows in X is not important.

Parameters
  • X (ndarray, shape (n_samples, n_features)) – The input data.

  • features (list, optional) – Feature names used for StreamHash. The repr() of list elements is used as basis for hashing, hence elements do not necessarily have to be strings. If None, range(n_features) is used as feature names.

Returns

X_tr – The projected data.

Return type

ndarray, shape (n_samples, n_features)