Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MaksimEkin/pyCP_ALS

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyCP_ALS


pyCP_ALS is the Python implementation of CP-ALS algorithm that was originally introduced in the MATLAB Tensor Toolbox [1,2].

Installation

Option 1: Install using pip

pip install git+https://github.com/MaksimEkin/pyCP_ALS.git

Option 2: Install from source

git clone https://github.com/MaksimEkin/pyCP_ALS.git
cd pyCP_ALS
conda create --name pyCP_ALS python=3.8.5
source activate pyCP_ALS
python setup.py install

Example Usage

from pyCP_ALS import CP_ALS
import pickle

data = pickle.load(open("data/toy_tensor.p", "rb"))
nnz_values = data["nnz_values"]
nnz_coords = data["nnz_coords"]

model = CP_ALS(
    tol=1e-4, 
    n_iters=50, 
    verbose=True, 
    fixsigns=True, 
    random_state=42,
)

M = model.fit(
    coords=nnz_coords, 
    values=nnz_values, 
    rank=2, 
    Minit="random",
)

See the examples for more.

How to Cite pyCP_ALS?

If you use pyCP_ALS, please cite it.

@MISC{Eren2022pyCP_ALS,
  author = {M. E. {Eren}},
  title = {{pyCP_ALS}},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/MaksimEkin/pyCP_ALS}}
}

Acknowledgments

This work was done as part of Maksim E. Eren's Master's Thesis at the University of Maryland, Baltimore County with the thesis committee members and collaborators Charles Nicholas, Edward Raff, Roberto Yus, Boian S. Alexandrov, and Juston S. Moore. pyCP_ALS was written as part of the RFoT methodology.

Developer Test Suite

Developer test suites are located under tests/ directory. Tests can be ran from this folder using python -m unittest *.

References

[1] General software, latest release: Brett W. Bader, Tamara G. Kolda and others, Tensor Toolbox for MATLAB, Version 3.2.1, www.tensortoolbox.org, April 5, 2021.

[2] Sparse, Kruskal, and Tucker tensors: B. W. Bader and T. G. Kolda, Efficient MATLAB Computations with Sparse and Factored Tensors, SIAM J. Scientific Computing, 30(1):205-231, 2007, http://dx.doi.org/10.1137/060676489.

About

Python implementation of CP-ALS algorithm.

Resources

License

Stars

Watchers

Forks

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.