Skip to main content

IQGO: Iterative Quantum Gate Optimiser

Project description

IQGO Module

Installation

To install the IQGO module, run the following command:

pip install IQGO-module

Getting Started

from IQGO_module.iqgo_training import IQGO_train
import numpy as np
import pandas as pd

X, y = load_iris(return_X_y=True, as_frame=True)

acc_test, acc_val, save_noise, cct = [], [], [], []

# test multiple seed values for gaussian noise
seeds = np.array([3646,5634,2342,234,546,564])

for noise in seeds:

    # initialise IQGO with the noise level, noise random seed and the kfold splits
    init_iqgo = IQGO_train(noise_level = 0.2, seed_val=noise, kfold_splits=5)

    fitted_circuit = init_iqgo.fit(data_train=X, labels=y, number_of_layers = 3)

    # hardcode the best compiled circuit for testing 
    #fitted_circuit = np.array([13, 26, 8]) #best

    predictions, column_means = init_iqgo.predict(data_train = X, labels = y, compiled_circuit=fitted_circuit,mode='test')
    acc_test.append(column_means)
    
    predictions, column_means = init_iqgo.predict(data_train = X, labels = y, compiled_circuit=fitted_circuit,mode='val')
    
    acc_val.append(column_means)
    save_noise.append(noise)
    cct.append(fitted_circuit)
    print('done')
    print(fitted_circuit)


print('Acc test: ',acc_test)
print('Acc val: ',acc_val)

save_noise = np.transpose(save_noise)

print(save_noise)
all = pd.DataFrame([save_noise, acc_test, acc_val, cct])

# save the compiled circuits to select the best one
all.to_csv('compiled_circuits.csv')

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

iqgo_module-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

IQGO_module-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file iqgo_module-0.1.1.tar.gz.

File metadata

  • Download URL: iqgo_module-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for iqgo_module-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0e7faa4364c7ae66faa74a3c0da16e5c54b64a54e2809b96612a2ba9d6b7dfc5
MD5 2646a2ed3fe47aa6003c1dbf1e51fcf4
BLAKE2b-256 a60b01b0e6db94a9edafffecce14e37dafd7acd5946c188f20f5fb3b6b48f893

See more details on using hashes here.

File details

Details for the file IQGO_module-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: IQGO_module-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for IQGO_module-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9a397560b1e1441f7913192398afc533ee2c00ab8def1788aa691abf421baaf
MD5 bd0a31a5148ab8b236a958d1c9adb1a0
BLAKE2b-256 7831889cf774f5a61d08d3ff446c0ebb00d69f67a13c57d923a7c56142a343d2

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