ynhe commited on
Commit
d25c469
1 Parent(s): 85ae27d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -80,16 +80,30 @@ def calculate_selected_score(df, selected_columns):
80
 
81
  def get_final_score(df, selected_columns):
82
  normalize_df = get_normalized_df(df)
83
- final_score = normalize_df.drop('name', axis=1).sum(axis=1)
 
 
 
 
 
84
  if 'Overall Score' in df:
85
  df['Overall Score'] = final_score
86
  else:
87
  df.insert(1, 'Overall Score', final_score)
 
 
 
 
 
 
 
 
 
88
  selected_score = calculate_selected_score(normalize_df, selected_columns)
89
- if 'Total Score' in df:
90
- df['Total Score'] = selected_score
91
  else:
92
- df.insert(1, 'Total Score', selected_score)
93
  return df
94
 
95
  def get_baseline_df():
 
80
 
81
  def get_final_score(df, selected_columns):
82
  normalize_df = get_normalized_df(df)
83
+ #final_score = normalize_df.drop('name', axis=1).sum(axis=1)
84
+ for name in normalize_df.drop('name', axis=1):
85
+ normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
86
+ quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
87
+ semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
88
+ final_score = quality_score+ semantic_score
89
  if 'Overall Score' in df:
90
  df['Overall Score'] = final_score
91
  else:
92
  df.insert(1, 'Overall Score', final_score)
93
+ final_score = quality_score+ semantic_score
94
+ if 'Semantic Score' in df:
95
+ df['Semantic Score'] = semantic_score
96
+ else:
97
+ df.insert(2, 'Semantic Score', semantic_score)
98
+ if 'Quality Score' in df:
99
+ df['Quality Score'] = quality_score
100
+ else:
101
+ df.insert(3, 'Quality Score', quality_score)
102
  selected_score = calculate_selected_score(normalize_df, selected_columns)
103
+ if 'Selected Score' in df:
104
+ df['Selected Score'] = selected_score
105
  else:
106
+ df.insert(1, 'Selected Score', selected_score)
107
  return df
108
 
109
  def get_baseline_df():