{"id":22937989,"url":"https://github.com/splch/chsh-predictor","last_synced_at":"2025-04-01T19:32:45.103Z","repository":{"id":267303045,"uuid":"613613619","full_name":"splch/chsh-predictor","owner":"splch","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-13T23:25:34.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T09:55:14.856Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/splch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-13T23:18:34.000Z","updated_at":"2023-03-13T23:25:38.000Z","dependencies_parsed_at":"2024-12-09T15:43:07.913Z","dependency_job_id":"ae0c8c21-0e70-40cb-89b1-b5050e4ffa43","html_url":"https://github.com/splch/chsh-predictor","commit_stats":null,"previous_names":["splch/chsh-predictor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splch%2Fchsh-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splch%2Fchsh-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splch%2Fchsh-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splch%2Fchsh-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splch","download_url":"https://codeload.github.com/splch/chsh-predictor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700410,"owners_count":20819866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T12:15:27.192Z","updated_at":"2025-04-01T19:32:45.078Z","avatar_url":"https://github.com/splch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quantum CHSH Correlation Predictor\n\nThis project aims to train a machine learning model that can predict the CHSH correlation of a two-qubit quantum circuit, given the values of three parameters: theta, 1-qubit gate error rate, and 2-qubit gate error rate.\n\nThe CHSH correlation is a well-known quantity used to test the violation of Bell's inequality and determine if the correlations between two distant systems are classical or quantum.\n\nThe model is trained using a dataset generated by simulating a quantum circuit that implements the CHSH game, adding depolarizing noise to the gates, and computing the resulting CHSH correlations. The simulation is done using the Qiskit framework.\n\n## Dependencies\n\n- Python 3.7 or higher\n- Qiskit\n- Scikit-learn\n- Pandas\n- Numpy\n\nThe dependencies can be installed by running:\n\n```shell\npip install -r requirements.txt\n```\n\n## Usage\n\nThe project consists of two main scripts: `circuit.py` and `model.py`.\n\n`circuit.py` contains the functions for generating the CHSH circuit and computing the CHSH correlation.\n\n`model.py` contains the functions for generating the dataset, training the machine learning model, and evaluating its performance.\n\nTo generate the dataset, run:\n\n```shell\npython model.py --generate\n```\n\nThis will create a CSV file data.csv containing the generated data.\n\nTo train the machine learning model, run:\n\n```shell\npython model.py --train\n```\n\nThis will train a linear regression model using the generated data and save it as a pickle file `model.pkl`.\n\nTo evaluate the model's performance, the script computes the R-squared score on a held-out test set.\n\n## Directory structure\n\n```\n.\n├── README.md\n├── circuit.py\n├── data.csv\n├── model.pkl\n├── model.py\n└── requirements.txt\n```\n\n`circuit.py` contains the code for the CHSH circuit simulation and CHSH correlation computation.\n\n`data.csv` contains the generated dataset.\n\n`model.pkl` is the trained machine learning model.\n\n`model.py` contains the code for generating the dataset, training the machine learning model, and evaluating its performance.\n\n`requirements.txt` contains the list of Python dependencies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplch%2Fchsh-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplch%2Fchsh-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplch%2Fchsh-predictor/lists"}