-
Notifications
You must be signed in to change notification settings - Fork 12
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
Error per context? #64
Comments
This is a great and interesting question indeed! It is possible that some contexts have more error than others, but we do not evaluate that. What I could think of an easy way of doing it by context is using your original tensor, subset by the context you are interested in and then do the same for the reconstructed tensor, subset it by the same context and compute the error. A quick pseudocode would be:
Let me know if this works or you have any questions |
Thanks for such a quick reply! I changed it slightly to get it to work for me, although I was expecting an error between 0 and 1 and actually get 2.something - but I'll read the c2c.tensor.factorization code to get my head around that. import tensorly as tl context_tensor = tensor_final.tensor[1, :, :, :] # Adjust index as needed context_rec_tensor = tl.cp_to_tensor(tensor_final.tl_object)[1, :, :, :] # Adjust index as needed err = c2c.tensor.factorization.normalized_error(context_tensor, context_rec_tensor) Edit: stupid mistake, the last line should be err = c2c.tensor.factorization.normalized_error(context_rec_tensor, context_tensor) for sensible values |
Sorry to add to this further - the method gives much higher error than expected from the elbow plot output, even when the full tensor is used rather than a slice. My understanding of the tensor package isn't good enough to work out what is going wrong. |
Hi,
Thanks for the great package. I just wondered if there's an easy way to return the error in the factorisation per context. If my understanding of the method is correct, there's a chance that the factors could fit (N-1)/N contexts very well while describing the Nth context very badly, but still be the best fit for the tensor as a whole. I just wanted to check that this wasn't the case.
The text was updated successfully, but these errors were encountered: