lda rounding off

This commit is contained in:
Kaushik Narayan R 2023-10-15 18:59:21 -07:00
parent 2509402651
commit 6a1c11a9fa
5 changed files with 12 additions and 0 deletions

View File

@ -199,6 +199,8 @@
" else:\n",
" min_value = np.min(label_rep)\n",
" feature_vectors_shifted = label_rep - min_value\n",
" # round off to reduce dictionary size\n",
" feature_vectors_shifted = np.round(feature_vectors_shifted, 3)\n",
" comparison_vector = data_model.transform(\n",
" feature_vectors_shifted.flatten().reshape(1, -1)\n",
" ).flatten()\n",

View File

@ -215,6 +215,8 @@
" else:\n",
" min_value = np.min(image_fd)\n",
" feature_vectors_shifted = image_fd - min_value\n",
" # round off to reduce dictionary size\n",
" feature_vectors_shifted = np.round(feature_vectors_shifted, 3)\n",
" comparison_vector = data_model.transform(\n",
" feature_vectors_shifted.flatten().reshape(1, -1)\n",
" ).flatten()\n",

View File

@ -213,6 +213,8 @@
" else:\n",
" min_value = np.min(image_fd)\n",
" feature_vectors_shifted = image_fd - min_value\n",
" # round off to reduce dictionary size\n",
" feature_vectors_shifted = np.round(feature_vectors_shifted, 3)\n",
" comparison_vector = data_model.transform(\n",
" feature_vectors_shifted.flatten().reshape(1, -1)\n",
" ).flatten()\n",

View File

@ -200,6 +200,8 @@
" else:\n",
" min_value = np.min(label_rep)\n",
" feature_vectors_shifted = label_rep - min_value\n",
" # round off to reduce dictionary size\n",
" feature_vectors_shifted = np.round(feature_vectors_shifted, 3)\n",
" comparison_vector = data_model.transform(\n",
" feature_vectors_shifted.flatten().reshape(1, -1)\n",
" ).flatten()\n",

View File

@ -948,6 +948,8 @@ def extract_latent_semantics_from_feature_model(
# so shift the input by subtracting the smallest value
min_value = np.min(feature_vectors)
feature_vectors_shifted = feature_vectors - min_value
# round off to reduce dictionary size
feature_vectors_shifted = np.round(feature_vectors_shifted, 3)
model = LatentDirichletAllocation(
n_components=k, learning_method="online", verbose=4
@ -1110,6 +1112,8 @@ def extract_latent_semantics_from_sim_matrix(
# so shift the input by subtracting the smallest value
min_value = np.min(feature_vectors)
feature_vectors_shifted = feature_vectors - min_value
# round off to reduce dictionary size
feature_vectors_shifted = np.round(feature_vectors_shifted, 3)
model = LatentDirichletAllocation(
n_components=k, learning_method="online", verbose=4