Skip to main content

A package for computing SVD via gradient descent

Project description

GDSVD is a package for computing SVD via gradient descent.

Example usage:

  1. Install via pip install gdsvd

  2. Import:

    from gdsvd.svd import gd_svd
    
  3. Memmap input data, recommended for large datasets

    U_true = np.memmap("datasets/ranklogn-exp-500_U.bin", dtype=np.float64, mode='r', shape=(500, 6))
    S_true = np.memmap("datasets/ranklogn-exp-500_S.bin", dtype=np.float64, mode='r', shape=(6,))
    Vt_true = np.memmap("datasets/ranklogn-exp-500_Vt.bin", dtype=np.float64, mode='r', shape=(6, 500))
    M = np.memmap("datasets/ranklogn-exp-500_M.bin", dtype=np.float64, mode='r', shape=(500, 500))
    
  4. Ensure that the arrays are contiguous

    U_true = np.ascontiguousarray(U_true)
    S_true = np.ascontiguousarray(S_true)
    Vt_true = np.ascontiguousarray(Vt_true)
    M = np.ascontiguousarray(M)
    
  5. To run the method normally:

    U,S,Vt = gd_svd(M)
    
  6. To run the method with convergence tracking written to conv_out.txt:

     U,S,Vt = gd_svd(M, record_conv = 'conv_out.txt', U_true = U_true, S_true = S_true, Vt_true = Vt_true)
    

gdsvd is implemented as Algorithm 4 in the reference paper.

Included in the package are gdsvd3 (Algorithm 3) and power-method (Algorithm 5), which is the GD method with alternate stopping and the power method, respectively.

Reference: k-SVD via gradient descent

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

gdsvd-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

gdsvd-0.1.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file gdsvd-0.1.3.tar.gz.

File metadata

  • Download URL: gdsvd-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gdsvd-0.1.3.tar.gz
Algorithm Hash digest
SHA256 346a1c5c783f376ff4c9c64c7fff18e0d7907fc0411085352a8509c90135442a
MD5 6b3ddd631e217faf31ae595689dbef06
BLAKE2b-256 8f114e3578847ff474f12be1161e74098d611d3e1dbe747c0c83d9c1a8bb8008

See more details on using hashes here.

File details

Details for the file gdsvd-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: gdsvd-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gdsvd-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f3a2709174ef8d4b19ad150e6c3cbb7d6404559b26dd53f7885e6ff230c68d02
MD5 8affc0c12f455e6e9e1c3f78ccf7e182
BLAKE2b-256 6d0c36a5b5bd79e2bc8bc71f8c3550cf51bd72556a2b16ab1eb9e7236a9c64dc

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