Skip to content

Instantly share code, notes, and snippets.

@afgane
Last active February 8, 2024 18:26
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 afgane/d421dcd3ce8977e2b533858558df4758 to your computer and use it in GitHub Desktop.
Save afgane/d421dcd3ce8977e2b533858558df4758 to your computer and use it in GitHub Desktop.
Jupyter within Galaxy
https://zenodo.org/record/4477881/files/X_test.tsv
https://zenodo.org/record/4477881/files/X_train.tsv
https://zenodo.org/record/4477881/files/y_test.tsv
https://zenodo.org/record/4477881/files/y_train.tsv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
with open('data/sentiment.txt', 'r') as file:
decimal_numbers = [float(line.strip()) for line in file]
categories = ['Positive sentiment', 'Negative sentiment']
num_positives = [n for n in decimal_numbers if n==1.0]
num_negatives = [n for n in decimal_numbers if n==0.0]
vals = [len(num_positives), len(num_negatives)]
fig = plt.figure(figsize = (10, 5))
plt.bar(categories, vals)
plt.gca().yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
plt.ylabel("Number of reviews")
plt.savefig(''outputs/plot.png'')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment