ddl.local.FeatureGroupsDestructor

class ddl.local.FeatureGroupsDestructor(groups_estimator=None, group_canonical_destructor=None, n_jobs=1)[source]

Bases: sklearn.base.BaseEstimator, ddl.base.DestructorMixin

Destructor that transforms groups of features independently.

Parameters:
groups_estimator : estimator, default=RandomFeaturePairs

Estimator that determines grouping.

group_canonical_destructor : estimator

Destructor that will be fitted and applied to each group of features independently.

n_jobs : int

Number of jobs to use when fitting or transforming. Leverages joblib.

Attributes:
groups_ : array-like, shape (n_groups, n_feature_per_group)

Feature indices for each group. Note that there should be no duplicate indices so that each group can be transformed independently.

group_destructors_ : array of estimators, shape (n_groups,)

Array of destructors for each feature group.

n_features_ : int

Number of features of the training data.

Methods

fit(self, X[, y]) Fit estimator to X.
fit_transform(self, X[, y]) Fit estimator to X and then transform X.
get_domain(self) Get the domain of this destructor.
get_params(self[, deep]) Get parameters for this estimator.
inverse_transform(self, X[, y]) Apply inverse destructive transformation to X.
sample(self[, n_samples, random_state]) Generate random samples from this density/destructor.
score(self, X[, y]) Return the mean log likelihood (or log(det(Jacobian))).
score_samples(self, X[, y]) Compute log-likelihood (or log(det(Jacobian))) for each sample.
set_params(self, \*\*params) Set the parameters of this estimator.
transform(self, X[, y]) Apply destructive transformation to X.
__init__(self, groups_estimator=None, group_canonical_destructor=None, n_jobs=1)[source]

Initialize self. See help(type(self)) for accurate signature.

fit(self, X, y=None, **fit_params)[source]

Fit estimator to X.

Parameters:
X : array-like, shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used in the fitting process but kept for compatibility.

fit_params : dict, optional

Optional extra fit parameters.

Returns:
self : estimator

Returns the instance itself.

fit_transform(self, X, y=None, **fit_params)[source]

Fit estimator to X and then transform X.

Parameters:
X : array-like, shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used in the fitting process but kept for compatibility.

fit_params : dict, optional

Parameters to pass to the fit method.

Returns:
X_new : array-like, shape (n_samples, n_features)

Transformed data.

get_domain(self)[source]

Get the domain of this destructor.

Returns:
domain : array-like, shape (2,) or shape (n_features, 2)

If shape is (2, ), then domain[0] is the minimum and domain[1] is the maximum for all features. If shape is (n_features, 2), then each feature’s domain (which could be different for each feature) is given similar to the first case.

get_params(self, deep=True)

Get parameters for this estimator.

Parameters:
deep : boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

inverse_transform(self, X, y=None)[source]

Apply inverse destructive transformation to X.

Parameters:
X : array-like, shape (n_samples, n_features)

New data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used in the transformation but kept for compatibility.

Returns:
X_new : array-like, shape (n_samples, n_features)

Transformed data.

sample(self, n_samples=1, random_state=None)

Generate random samples from this density/destructor.

Parameters:
n_samples : int, default=1

Number of samples to generate. Defaults to 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 numpy.random.

Returns:
X : array, shape (n_samples, n_features)

Randomly generated sample.

score(self, X, y=None)

Return the mean log likelihood (or log(det(Jacobian))).

Parameters:
X : array-like, shape (n_samples, n_features)

New data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used but kept for compatibility.

Returns:
log_likelihood : float

Mean log likelihood data points in X.

score_samples(self, X, y=None)[source]

Compute log-likelihood (or log(det(Jacobian))) for each sample.

Parameters:
X : array-like, shape (n_samples, n_features)

New data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used but kept for compatibility.

Returns:
log_likelihood : array, shape (n_samples,)

Log likelihood of each data point in X.

set_params(self, **params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
self
transform(self, X, y=None)[source]

Apply destructive transformation to X.

Parameters:
X : array-like, shape (n_samples, n_features)

New data, where n_samples is the number of samples and n_features is the number of features.

y : None, default=None

Not used in the transformation but kept for compatibility.

Returns:
X_new : array-like, shape (n_samples, n_features)

Transformed data.