de-Rodrigo commited on
Commit
f24148c
1 Parent(s): f4417fd

Include Weight Selector for Weighted Computation

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -14,7 +14,7 @@ from sklearn.linear_model import LinearRegression
14
 
15
  N_COMPONENTS = 2
16
  TSNE_NEIGHBOURS = 150
17
- WEIGHT_FACTOR = 0.05
18
 
19
  TOOLTIPS = """
20
  <div>
@@ -28,6 +28,7 @@ TOOLTIPS = """
28
  """
29
 
30
  def config_style():
 
31
  st.markdown("""
32
  <style>
33
  .main-title { font-size: 50px; color: #4CAF50; text-align: center; }
@@ -533,13 +534,19 @@ def optimize_tsne_params(df_combined, embedding_cols, df_f1, distance_metric):
533
  def run_model(model_name):
534
  version = st.selectbox("Select Model Version:", options=["vanilla", "finetuned_real"], key=f"version_{model_name}")
535
  # Selector para el m茅todo de c贸mputo del embedding
536
- embedding_computation = st.selectbox("驴C贸mo se computa el embedding?", options=["weighted", "averaged"], key=f"embedding_method_{model_name}")
537
  # Se asigna el prefijo correspondiente
538
 
539
  if embedding_computation == "weighted":
540
- weight_factor = f"{WEIGHT_FACTOR}_"
 
 
 
 
 
 
541
  else:
542
- weight_factor = ""
543
 
544
  embeddings = load_embeddings(model_name, version, embedding_computation, weight_factor)
545
  if embeddings is None:
 
14
 
15
  N_COMPONENTS = 2
16
  TSNE_NEIGHBOURS = 150
17
+ # WEIGHT_FACTOR = 0.05
18
 
19
  TOOLTIPS = """
20
  <div>
 
28
  """
29
 
30
  def config_style():
31
+ # st.set_page_config(layout="wide")
32
  st.markdown("""
33
  <style>
34
  .main-title { font-size: 50px; color: #4CAF50; text-align: center; }
 
534
  def run_model(model_name):
535
  version = st.selectbox("Select Model Version:", options=["vanilla", "finetuned_real"], key=f"version_{model_name}")
536
  # Selector para el m茅todo de c贸mputo del embedding
537
+ embedding_computation = st.selectbox("驴C贸mo se computa el embedding?", options=["averaged", "weighted"], key=f"embedding_method_{model_name}")
538
  # Se asigna el prefijo correspondiente
539
 
540
  if embedding_computation == "weighted":
541
+ selected_weight_factor = st.selectbox(
542
+ "Seleccione el Weight Factor",
543
+ options=[0.05, 0.1, 0.25, 0.5],
544
+ index=0, # 铆ndice 1 para que por defecto sea 0.05
545
+ key=f"weight_factor_{model_name}"
546
+ )
547
+ weight_factor = f"{selected_weight_factor}_"
548
  else:
549
+ weight_factor = ""
550
 
551
  embeddings = load_embeddings(model_name, version, embedding_computation, weight_factor)
552
  if embeddings is None: