Update resultados_consulta.py
Browse files- resultados_consulta.py +3 -2
resultados_consulta.py
CHANGED
@@ -61,10 +61,11 @@ def retrieve_index(data,cosine_scores, document_index, topn=10):
|
|
61 |
data = data.set_index(document_index)
|
62 |
data['scores'] = cosine_scores
|
63 |
df_top_scores=data.reset_index().sort_values('scores',ascending=False).head(topn)
|
64 |
-
|
|
|
65 |
st.write(df_top_scores)
|
66 |
|
67 |
-
|
68 |
|
69 |
return df_top_scores.index # Dataframe original con los scores
|
70 |
# del coseno en una columna nueva
|
|
|
61 |
data = data.set_index(document_index)
|
62 |
data['scores'] = cosine_scores
|
63 |
df_top_scores=data.reset_index().sort_values('scores',ascending=False).head(topn)
|
64 |
+
cutoff=np.average(df_top_scores['scores'])+0.75*np.std(df_top_scores['scores'])
|
65 |
+
df_top_scores=df_top_scores[df_top_scores['scores'] > cutoff]
|
66 |
st.write(df_top_scores)
|
67 |
|
68 |
+
|
69 |
|
70 |
return df_top_scores.index # Dataframe original con los scores
|
71 |
# del coseno en una columna nueva
|