Skip to content

Instantly share code, notes, and snippets.

@rafaljanwojcik
Created November 26, 2019 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaljanwojcik/9add154cb42b2450d68134a7150de65c to your computer and use it in GitHub Desktop.
Save rafaljanwojcik/9add154cb42b2450d68134a7150de65c to your computer and use it in GitHub Desktop.
replacement_df = pd.DataFrame(data=[replaced_closeness_scores, replaced_tfidf_scores, file_weighting.title, file_weighting.rate]).T
replacement_df.columns = ['sentiment_coeff', 'tfidf_scores', 'sentence', 'sentiment']
replacement_df['sentiment_rate'] = replacement_df.apply(lambda x: np.array(x.loc['sentiment_coeff']) @ np.array(x.loc['tfidf_scores']), axis=1)
replacement_df['prediction'] = (replacement_df.sentiment_rate>0).astype('int8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment