AWS Braket State Space Modeler, 2025

Almost every discipline, from climate science to e-commerce, does or can utilize state space data, or probability landscapes. Due to the probabilistic nature of quantum computing, it happens to excel at modeling such information. 


Increasing accessibility and democratization of quantum computing, while creating new user interfaces and software platforms for mapping and modeling cross-disciplinary state space information, will help expand quantum computing to relevance across disciplines.


Towards such a goal, this prototype web application allows a user convert a CSV dataset into .json state vector file (if needed) and turn the information into a state space snapshot in the form of a series of quantum gates, in order to recreate the state space of the dataset for true probabilistic modeling with a quantum computer. The app automatically scales quantum computing resources and the number of qubits to match the size of the dataset.


Although the application backend is compatible with both the Braket local simulator for smaller datasets (approximately 1024 entires or fewer), and the SV1 simulator for larger datasets (30,000+ entries), SV1 use for larger datasets requiring >10 qubits is currently restricted for public use due to costs, and uploading large datasets will result in an error. However, costs are predicted to drop in the future so that free access to modeling the state space of much larger datasets with tens of thousands of entries and tens of millions of possibilities is foreseeable in the near future. The media above shows tests ranging from a tiny practice dataset with 4 entries, which uses 2 qubits, to a larger dataset with ~32,768 entires, which uses 15 qubits. 


For more on accessible quantum computing with AWS Braket, click here: https://aws.amazon.com/braket/ 


To convert a csv dataset of various sizes to a json state vector, the code below the app at the bottom of the page can be used in a Python IDE such as Google Colab.



Braket State Simulator

Braket State Simulator

Processing... This may take a few minutes.

Number of Qubits: -

Generated Braket Code


    

# Convert csv to json state vector


import pandas as pd

import numpy as np

import json

import math


# Load data

df = pd.read_csv('ecommerce_25qubit_100k.csv')


# Frequency histogram of unique states

freq = df.value_counts(normalize=True).to_dict()  # (state_tuple): probability


# Determine the number of unique states

num_states = len(freq)

print(f"Number of unique states: {num_states}")


# Calculate the number of qubits needed

num_qubits = max(1, min(25, math.ceil(math.log2(num_states))))

print(f"Number of qubits required: {num_qubits}")


# State vector size (2^num_qubits elements)

state_vector_size = 2**num_qubits

state_vector = np.zeros(state_vector_size, dtype=complex)


# Map states to indices

state_to_index = {}

current_index = 0


for state_tuple in freq.keys():

    if current_index >= state_vector_size:

        break  # Stop if we’ve filled the state vector

    state_to_index[state_tuple] = current_index

    state_vector[current_index] = np.sqrt(freq[state_tuple])

    current_index += 1


# Normalize the state vector

norm = np.linalg.norm(state_vector)

if norm > 0:

    state_vector /= norm

else:

    raise ValueError("State vector norm is zero; dataset may be empty or invalid.")


# Convert state vector to JSON format: list of [real, imaginary] pairs

state_vector_json = [[float(v.real), float(v.imag)] for v in state_vector]


# Save as JSON

with open(f'test_state_vector_{num_qubits}q.json', 'w') as f:

    json.dump(state_vector_json, f)


# Verify

print(f"Max index used: {max([i for i, v in enumerate(state_vector) if v != 0], default=-1)}")

print(f"Vector length: {len(state_vector)}")

print(f"Sum of probabilities: {np.sum(np.abs(state_vector)**2):.6f}")

print(f"State vector saved as 'test_state_vector_{num_qubits}q.json'")