Skip to main content

Quatum image classifier: A library of different quantum algorithms used to classify images

Project description

Quantum image classifier

Data use

You can generate synthetic data by calling the function generate_synthetic_data(n_dim: int, n_clusters: int, m_samples: int) implemented in data_generator.py. You have to be aware that, in order to Nearest Centroid to work, n_dim has to be power of 2. This function returns a set of m_samples vectors X with a set of labels y associated with the vector in the same possition on X. Example:

X, y = generate_synthetic_data(8, 4, 250)
train_X = X[:200]
train_y = y[:200]
test_X = X[200:]
test_y = y[200:]

If you want, you can also use the MNIST dataset with a PCA function used to reduce the dimension to n components calling get_MNIST(n_components) implemented in data_loader.py. Same as with the synthetic data, you have to be aware to use only an power of 2 to make Nearest Centroid work. Example:

train_X, train_y, test_X, test_y = get_MNIST(8)

Classifiers

Nearest centroid

Once you get the data, you need to create the object NearestCentroid with the training dataset that you want. After that, you can call the function predict(self, X: np.ndarray) owned by the defined object. Example:

train_X, train_y, test_X, test_y = get_MNIST(8)
nearest_centroid = NearestCentroid(train_X, train_y, n_dim)
labels_predicted = nearest_centroid.predict(test_X)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantum-image-classifier-0.1.5.tar.gz (10.3 kB view details)

Uploaded Source

File details

Details for the file quantum-image-classifier-0.1.5.tar.gz.

File metadata

  • Download URL: quantum-image-classifier-0.1.5.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.3

File hashes

Hashes for quantum-image-classifier-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b3d5fc6a77c6359b418fa932bbc2378ae12d2d54af5a679a17944475b235ac84
MD5 553514d93a3031dcb85aed61ad0cc4fb
BLAKE2b-256 d3f7bb2019d0a5371e18c97c4b4bd7643799fe1dab729b449418089a3f22b49b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page