Last active
February 8, 2024 18:26
-
-
Save afgane/d421dcd3ce8977e2b533858558df4758 to your computer and use it in GitHub Desktop.
Jupyter within Galaxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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