-
Notifications
You must be signed in to change notification settings - Fork 14
Example tensor for cp_als needs to have CP structure #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@tgkolda To date, we have tried to provide synthetic data in Here is a change that creates an example of a small tensor with CP structure: # Pick the rank and shape
R = 3
tensor_shape = (6, 8, 10)
# Set seed for reproducibility
np.random.seed(0)
# Create a low-rank dense tensor from a Kruskal tensor
factor_matrices = [np.random.rand(s,R) for s in tensor_shape]
X = ttb.ktensor(factor_matrices).to_tensor() Using # Compute a solution with final ktensor stored in M1
np.random.seed(0) # Set seed for reproducibility
short_tutorial = 10 # Cut off solve early for demo
(M1, M1_init, M1_out) = ttb.cp_als(X, R, maxiters=short_tutorial) produces the following output, illustrating that we can recover the structure:
I like this example because I think that illustrating that Questions:
|
Nevermind, there was an error in my updated code. I was creating a I'll make the updates to the initial problem and commit the changes for now. The long term solution is to address Issue #312 so we can generate data more readily in the tutorial and documentation. |
The example being used to demo cp_als in https://pyttb.readthedocs.io/en/latest/tutorial/algorithm_cp_als.html is just a random tensor. Random tensors do not have CP structure, so this is not a good example to use. Either use the amino acids data or create a small tensor with structure.
The text was updated successfully, but these errors were encountered: