prevision_quantum_nn.preprocessing.preprocess

preprocessing module

Module Contents

Classes

Preprocessor

Class Preprocessor, preprocesses features for quantum models.

class prevision_quantum_nn.preprocessing.preprocess.Preprocessor(params)

Class Preprocessor, preprocesses features for quantum models.

polynomial_expander

the polynomial expander

Type

PolynomialExpander

polynomial_expansion_type

can be either polynomial_features or kronecker

Type

str

feature_engineer

feature engineer object

Type

FeatureEngineer

dimension_reduction_fitter

can be either wrapper or pca

Type

str

force_dimension_reduction

if True, dimension reduction will be forced if False, errors will prompt if the data does not fit into the quantum computer

Type

bool

__getstate__(self)
__setstate__(self, d)
check_preprocessor(self)

Checks the preprocessor consistency.

Raises

ValueError if parameters are not consistent

build_for_model(self, architecture_type, encoding, num_q, type_problem, rl_bounds=None, rl_tanh_mask=None, rl_discrete_depth=None)

Builds the preprocessor for a given model.

Parameters

model (QuantumNeuralNetwork) – model that needs to be used with this preprocessing

fit_transform(self, features, labels)

Fit and transforms features.

Parameters
  • features (numpy array) – input features

  • labels (numpy array) – data label

Returns

numpy array

transformed features

Return type

features

transform(self, features)

Transforms features.

Parameters

features (numpy array) – input features

Returns

numpy array

transformed features

Return type

features

compute_dimension_reduction_params(self, data_dim)

Compute dimensions reduction parameters.

Parameters

data_dim (int) – dimension of the data

apply_padding(self, features)

Apply padding to data

Parameters

features (numpy array) – features to be padded