Chris4K commited on
Commit
108d06b
·
verified ·
1 Parent(s): 226d49a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -283,6 +283,7 @@ def calculate_statistics(results, search_time, vector_store, num_tokens, embeddi
283
  # Silhouette Score
284
  if len(embeddings) > 2:
285
  print('-----')
 
286
  #stats["silhouette_score"] = silhouette_score(embeddings, range(len(embeddings)))
287
  else:
288
  stats["silhouette_score"] = "N/A"
@@ -292,7 +293,8 @@ def calculate_statistics(results, search_time, vector_store, num_tokens, embeddi
292
 
293
  query_embedding = embedding_model.embed_query(query)
294
  result_embeddings = [embedding_model.embed_query(doc.page_content) for doc in results]
295
- similarities = [np.inner(query_embedding, emb)[0] for emb in result_embeddings]
 
296
  rank_correlation, _ = spearmanr(similarities, range(len(similarities)))
297
  stats["rank_correlation"] = rank_correlation
298
 
 
283
  # Silhouette Score
284
  if len(embeddings) > 2:
285
  print('-----')
286
+ stats["silhouette_score"] = "N/A"
287
  #stats["silhouette_score"] = silhouette_score(embeddings, range(len(embeddings)))
288
  else:
289
  stats["silhouette_score"] = "N/A"
 
293
 
294
  query_embedding = embedding_model.embed_query(query)
295
  result_embeddings = [embedding_model.embed_query(doc.page_content) for doc in results]
296
+ similarities = [np.inner(query_embedding, emb) for emb in result_embeddings]
297
+ #similarities = [np.inner(query_embedding, emb)[0] for emb in result_embeddings]
298
  rank_correlation, _ = spearmanr(similarities, range(len(similarities)))
299
  stats["rank_correlation"] = rank_correlation
300