Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Encoding classes should not require pixel_values #59

Closed
SaashaJoshi opened this issue Feb 27, 2024 · 1 comment · Fixed by #68
Closed

Data Encoding classes should not require pixel_values #59

SaashaJoshi opened this issue Feb 27, 2024 · 1 comment · Fixed by #68
Labels
design-issue This is a design issue and requires major change good first issue Good for newcomers urgent An urgent requirement
Milestone

Comments

@SaashaJoshi
Copy link
Owner

Data encoding classes should not require a pixel_value argument such that the encoding technique can be used with SamplerQNN or EstimatorQNN primitives. The primitives, currently, require that the circuit or neural_network and the pixel_values or input_params be passed separately for model training purposes.

An ideal data encoding function should look like below:

def angle_encoding(img_dims: tuple[int, int]) -> QuantumCircuit:
    feature_dims = int(math.prod(img_dims))
    embedding = QuantumCircuit(feature_dims)
    feature_param = ParameterVector("Theta", feature_dims)
    for qubit in range(feature_dims):
        embedding.ry(feature_param[qubit], qubit)
    return embedding

The feature_param attribute should be accessible from outside the function/class as well. This can be built as a property method in an encoding class.

@SaashaJoshi SaashaJoshi added good first issue Good for newcomers design-issue This is a design issue and requires major change labels Feb 27, 2024
@SaashaJoshi SaashaJoshi added the urgent An urgent requirement label Apr 24, 2024
@SaashaJoshi SaashaJoshi added this to the v0.1.0 milestone Apr 29, 2024
@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Jun 2, 2024

QIR methods that encode pixel_vals in the basis state of the quantum circuit cannot be replaced with ParameterVector when the pixel_vals argument is None. The reason is that a basis state is created by converting the pixel values to a binary string, and until a ParameterVector is assigned integral values it cannot be converted to a binary format.

This incapability of defaulting pixel_vals to None also confirms that the current dependence of piQture on the Qiskti Machine Learning library and its neural_network module for classification cannot be utilized with QIR encodings that encode color information in the basis state of the quantum circuit (#35). This dependence must be removed, or the basis state encodings must be deemed incompatible with training neural networks and other QML models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-issue This is a design issue and requires major change good first issue Good for newcomers urgent An urgent requirement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant