mirror of
https://github.com/20kaushik02/CSE515_MWDB_Project.git
synced 2025-12-06 11:04:07 +00:00
utils
This commit is contained in:
parent
d8490c7c4b
commit
53e284ae95
@ -998,6 +998,7 @@ def extract_latent_semantics_from_feature_model(
|
|||||||
) as output_file:
|
) as output_file:
|
||||||
json.dump(all_latent_semantics, output_file, ensure_ascii=False)
|
json.dump(all_latent_semantics, output_file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
def extract_latent_semantics_from_sim_matrix(
|
def extract_latent_semantics_from_sim_matrix(
|
||||||
sim_matrix,
|
sim_matrix,
|
||||||
feature_model,
|
feature_model,
|
||||||
@ -1080,7 +1081,8 @@ def extract_latent_semantics_from_sim_matrix(
|
|||||||
)
|
)
|
||||||
model.fit(feature_vectors_shifted)
|
model.fit(feature_vectors_shifted)
|
||||||
|
|
||||||
W, H = nmf(feature_vectors_shifted, k = k)
|
W = model.transform(feature_vectors_shifted)
|
||||||
|
H = model.components_
|
||||||
|
|
||||||
all_latent_semantics = {
|
all_latent_semantics = {
|
||||||
"image-semantic": W.tolist(),
|
"image-semantic": W.tolist(),
|
||||||
@ -1171,6 +1173,7 @@ def extract_latent_semantics_from_sim_matrix(
|
|||||||
) as output_file:
|
) as output_file:
|
||||||
json.dump(all_latent_semantics, output_file, ensure_ascii=False)
|
json.dump(all_latent_semantics, output_file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
def find_label_label_similarity(fd_collection, feature_model):
|
def find_label_label_similarity(fd_collection, feature_model):
|
||||||
"""
|
"""
|
||||||
Calculate similarity between labels. Lower values indicate higher similarities
|
Calculate similarity between labels. Lower values indicate higher similarities
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user