mirror of
https://github.com/20kaushik02/CSE515_MWDB_Project.git
synced 2025-12-06 09:24:07 +00:00
utils
This commit is contained in:
parent
950d4237b3
commit
a5b877b6a3
@ -878,7 +878,7 @@ def extract_latent_semantics_from_feature_model(
|
|||||||
# singular value decomposition
|
# singular value decomposition
|
||||||
# sparse version of SVD to get only k singular values
|
# sparse version of SVD to get only k singular values
|
||||||
case 1:
|
case 1:
|
||||||
U, S, V_T = svd(feature_vectors, k=k)
|
U, S, V_T = svds(feature_vectors, k=k)
|
||||||
|
|
||||||
all_latent_semantics = {
|
all_latent_semantics = {
|
||||||
"image-semantic": U.tolist(),
|
"image-semantic": U.tolist(),
|
||||||
@ -1246,4 +1246,4 @@ def compute_cp_decomposition(fd_collection, feature_model, rank):
|
|||||||
data_tensor[id, :, label] = all_images[id][feature_model]
|
data_tensor[id, :, label] = all_images[id][feature_model]
|
||||||
|
|
||||||
weights_tensor, factor_matrices = tl.decomposition.parafac(data_tensor, rank=rank, normalize_factors=True)
|
weights_tensor, factor_matrices = tl.decomposition.parafac(data_tensor, rank=rank, normalize_factors=True)
|
||||||
return weights_tensor, factor_matrices
|
return weights_tensor, factor_matrices
|
||||||
Loading…
x
Reference in New Issue
Block a user