NICE

class blocks.grouping.StandardBlock(covariants_expansioner=None, covariants_purifier=None, covariants_pca=None, invariants_expansioner=None, invariants_purifier=None, invariants_pca=None, guaranteed_parts_fitted_consistently=False)

Bases: object

Block for standard procedure of body order increasement step

fit(first_even, first_odd, second_even, second_odd, old_even_covariants=None, old_odd_covariants=None, old_even_invariants=None, clebsch_gordan=None)
get_intermediate_shapes()
is_fitted()
transform(first_even, first_odd, second_even, second_odd, old_even_covariants=None, old_odd_covariants=None, old_even_invariants=None)
class blocks.grouping.StandardSequence(blocks, initial_pca=None, initial_scaler=None, guaranteed_parts_fitted_consistently=False)

Bases: object

Block implementing logic of main NICE sequence

fit(coefficients, clebsch_gordan=None)
get_intermediate_shapes()
is_fitted()
transform(coefficients, return_only_invariants=False)
blocks.grouping.check_if_all_fitted(parts)

Compressors

class blocks.compressors.IndividualLambdaPCAs(n_components=None, num_to_fit='10x')

Bases: object

Block to do pca step for covariants of single parity. It operates with instances of Data class

fit(data)
get_importances()
is_fitted()
transform(data)
class blocks.compressors.IndividualLambdaPCAsBoth(*args, **kwargs)

Bases: object

Block to do pca step for covariants of both parities. It operates with even-odd pairs of instances of Data class

fit(data_even, data_odd)
is_fitted()
transform(data_even, data_odd)
class blocks.compressors.InvariantsPCA(*args, num_to_fit='10x', **kwargs)

Bases: sklearn.decomposition._pca.PCA

Block to do pca step for invariants. It operates with 2d numpy arrays

fit(X)

Fit the model with X.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Training data, where n_samples is the number of samples and n_features is the number of features.

  • y (Ignored) –

Returns

self – Returns the instance itself.

Return type

object

fit_transform(X)

Fit the model with X and apply the dimensionality reduction on X.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Training data, where n_samples is the number of samples and n_features is the number of features.

  • y (Ignored) –

Returns

X_new – Transformed values.

Return type

ndarray of shape (n_samples, n_components)

Notes

This method returns a Fortran-ordered array. To convert it to a C-ordered array, use ‘np.ascontiguousarray’.

is_fitted()
process_input(X)
transform(X)

Apply dimensionality reduction to X.

X is projected on the first principal components previously extracted from a training set.

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.

Returns

X_new

Return type

array-like, shape (n_samples, n_components)

blocks.compressors.get_num_fit(desired_num, block_size)

Expansioners

class blocks.expansioners.ThresholdExpansioner(num_expand=None, mode='covariants', num_threads=None)

Bases: object

Block to do Clebsch-Gordan iteration. It uses two even-odd pairs of Data instances with covariants to produce new ones. If first even-odd pair contains covariants of body order v1, and the second v2, body order of the result would be v1 + v2.

fit(first_even, first_odd, second_even, second_odd, clebsch_gordan=None)
is_fitted()
transform(first_even, first_odd, second_even, second_odd)

Purifiers

class blocks.purifiers.CovariantsIndividualPurifier(regressor=None, num_to_fit='10x', max_take=None)

Bases: object

Block to purify single covariants lambda channel. It operates with 3 dimensional numpy arrays with indexing [environmental_index, feature_index, m]

fit(old_blocks, new_block, l)
is_fitted()
transform(old_blocks, new_block, l)
class blocks.purifiers.CovariantsPurifier(regressor=None, num_to_fit='10x', max_take=None)

Bases: object

Block to purify covariants of single parity. It operates with instances of Data class with covariants

fit(old_datas, new_data)
is_fitted()
transform(old_datas, new_data)
class blocks.purifiers.CovariantsPurifierBoth(regressor=None, num_to_fit='10x', max_take=None)

Bases: object

Block to purify covariants of both parities. It operates with pairs of instances of Data class with covariants

fit(old_datas_even, new_data_even, old_datas_odd, new_data_odd)
is_fitted()
transform(old_datas_even, new_data_even, old_datas_odd, new_data_odd)
class blocks.purifiers.InvariantsPurifier(regressor=None, num_to_fit='10x', max_take=None)

Bases: object

Block to purify invariants. It operates with numpy 2d arrays containing invariants

fit(old_blocks, new_block)
is_fitted()
transform(old_blocks, new_block)

Miscellaneous

class blocks.miscellaneous.InitialScaler(mode='signal integral', individually=False)

Bases: object

Block to scale initial spherical expansion coefficients in a certain way. It allows to both normalize coefficients for each environment individually, and to multiply whole array to single scaling factor, thus, preserving information about relative scale

fit(coefficients)
is_fitted()
transform(coefficients)
class blocks.miscellaneous.InitialTransformer

Bases: object

Utility block to split spherical expansion coefficients stored in the form of single numpy array to even-odd pair of Data instances

is_fitted()
transform(coefficients)
class blocks.miscellaneous.ParityDefinitionChanger

Bases: object

Block to change parity definition from even-odd to true-pseudo and vice versa

is_fitted()
transform(first_data, second_data)