GameReview commited on
Commit
ff2634c
1 Parent(s): 4474e9f

updated weights

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -132,7 +132,10 @@ def addWeights(df,progress=gr.Progress()):
132
  def getWeightSentimentAll(df, progress=gr.Progress()):
133
  df1 = addWeights(df,progress)
134
  #Start at default 0.5, add the results of positive sentiment and subtract negative sentiment
135
- weighted_avg = (df1['Positive_Sentiment'] * df1['Weights']).sum()*0.5 - (df1['Negative_Sentiment'] * df1['Weights']).sum()*0.5 + 0.5
 
 
 
136
  df['Weighted Average'] = weighted_avg
137
  return weighted_avg
138
 
 
132
  def getWeightSentimentAll(df, progress=gr.Progress()):
133
  df1 = addWeights(df,progress)
134
  #Start at default 0.5, add the results of positive sentiment and subtract negative sentiment
135
+ total_sum = 0
136
+ for value1, value2 in zip(df1['Neural_Sentiment'], df1['Weights']):
137
+ total_sum += value1 * value2
138
+ weighted_avg = (df1['Positive_Sentiment'] * df1['Weights']).sum() * 0.2699488 + total_sum * 0.53425314 - (df1['Negative_Sentiment'] * df1['Weights']).sum() * 0.3747967 + 0.5
139
  df['Weighted Average'] = weighted_avg
140
  return weighted_avg
141