Coder Social home page Coder Social logo

resmps's Introduction

ResMPS: Residual Matrix Product State

ResMPS (short for 'Residual Matrix Product State') is a PyTorch based tensor network machine learning architecture.

The idea of ResMPS is inpired by residual networks, and outperforms the state-of-the-art tensor network models in terms of efficiency, stability, and expression power.

For further details, please see our paper SciPost Physics 14.6 (2023): 142.

Installation

  1. Install dependencies.
  • torch
  • torchvision
  • hilbertcurve
  • matplotlib
  • sklearn
  • dill

The cuda version of PyTorch is recommended.

  1. Clone this repo.
git clone https://github.com/YemingMeng/ResMPS.git

Usage/Examples

  • Print help of usage information.
python main.py -h
  • Typical command example, here cuda for GPU acceleration and fashion_mnist is the dataset.
python main.py --device cuda --dataset fashion_mnist
python examples.py
  • Use ResMPS in general case, create your python script like this
from ResMPS import ResMPS

nfeatures = 2     # dimension of the feature map function
nchi      = 12    # dimension of the virtual feature
nrow      = 28    # number of rows of the input image
ncol      = 28    # number of columns of the input image
nlength   = 785   # length of ResMPS, needs to match the dimension of input
noutput   = 10    # dimension of the output, i.e., the total number of categories

batch_size = 1000 # input batch size
cf = ResMPS(nfeatures, nchi, nlength, noutput) # create an instance of ResMPS
input = th.rand(batch_size, 1, nrow, ncol, device=cf.device) # generate random input data
output = cf(input)  # data processing by using ResMPS
print(output.shape) # check the shape of output

Citing ResMPS

Include this BibTex Entry to your .bib file

@misc{https://doi.org/10.48550/arxiv.2012.11841,
  doi = {10.48550/ARXIV.2012.11841},
  url = {https://arxiv.org/abs/2012.11841},
  author = {Meng, Ye-Ming and Zhang, Jing and Zhang, Peng and Gao, Chao and Ran, Shi-Ju},
  title = {Residual Matrix Product State for Machine Learning},
  publisher = {arXiv},
  year = {2020},
  copyright = {arXiv.org perpetual, non-exclusive license}
}

License

MIT License

resmps's People

Contributors

yemingmeng avatar

Stargazers

 avatar

Watchers

 avatar Kostas Georgiou avatar

resmps's Issues

When setting '--classical' to 'True', an error occurred.

您好,当我想要测试regular MPS性能时发生了错误:

在已有代码的基础上,我仅修改了以下的一行代码,训练结果崩溃了。

# parser.add_argument('--classical', default=False, action='store_true', ...)
parser.add_argument('--classical', default=True, action='store_true', ...)

结果输出 :

learning rate=0.0001
starting training process...
(step/total)=(  60/  60), batch accuracy = 10.20%.
starting evaluating process...
train set accuracy = 10.00%
test  set accuracy = 10.00%
train set loss     = 2.30258
test  set loss     = 2.30258
convergence factor = 0.00000
run epoch_step in 25.25 seconds

从step 1开始,所有结果都约为10%,我重复了多次,且尝试了不同的数据集,都得到了类似的结果。当将classical设置为False后,一切恢复正常,请问是什么问题呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.