From 9cb9c04f92e83554ceb0fe071fe03310012e822c Mon Sep 17 00:00:00 2001 From: wea_ondara Date: Fri, 8 May 2020 09:25:50 +0200 Subject: [PATCH] wip --- its.py | 6 +++--- votes.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/its.py b/its.py index 4d9932c..f46d876 100644 --- a/its.py +++ b/its.py @@ -12,7 +12,7 @@ from loader import load, dmt, cms from sentiments import readtoxleveltxt colors = ['red', 'green', 'blue', 'orange', 'deeppink'] -thresholds = [3, 4, 5, 6] +thresholds = [6, 9, 12, 15] changedate = datetime.fromisoformat("2018-09-01T00:00:00") @@ -72,7 +72,7 @@ def main(folder, intervl): print("Computing full ITS") t = np.reshape(np.array([i for i in range(len(datasingle)) for j in datasingle[i]]), (-1, 1)) - x = np.reshape(np.array([(0 if intervals[i][1] <= changedate else 1) for i in range(len(datasingle)) for j in datasingle[i]]), (-1, 1)) + x = np.reshape(np.array([(0 if intervals[i][0] <= changedate else 1) for i in range(len(datasingle)) for j in datasingle[i]]), (-1, 1)) X = np.array(t) X = np.concatenate((X, x), 1) X = np.concatenate((X, np.multiply(t, x)), 1) @@ -100,7 +100,7 @@ def main(folder, intervl): # print("iv " + str(iv)) d = [x for (i, x) in z] t = np.reshape(np.array([i for i in range(len(d)) for j in d[i]]), (-1, 1)) - x = np.reshape(np.array([(0 if iv[i][1] <= changedate else 1) for i in range(len(d)) for j in d[i]]), (-1, 1)) + x = np.reshape(np.array([(0 if iv[i][0] <= changedate else 1) for i in range(len(d)) for j in d[i]]), (-1, 1)) X = np.array(t) X = np.concatenate((X, x), 1) X = np.concatenate((X, np.multiply(t, x)), 1) diff --git a/votes.py b/votes.py index 3746282..8720b86 100644 --- a/votes.py +++ b/votes.py @@ -94,7 +94,7 @@ def main(folder, intervl): # votes over time votes = readVotes(folder) fig = plt.figure(figsize=FIG_SIZE) - ivs = [(datetime.fromisoformat("2010-01-01T00:00:00"), datetime.fromisoformat(str(y) + "-01-01T00:00:00")) for y in range(2011, 2020)] + ivs = [(datetime.fromisoformat("2010-01-01T00:00:00"), datetime.fromisoformat(str(y) + "-01-01T00:00:00")) for y in range(2011, 2021)] for interval in ivs: print(interval[0].strftime("%d-%m-%Y") + " to " + interval[1].strftime("%d-%m-%Y")) ivvotes = dmt(votes).filter(lambda v: interval[0] <= v['CreationDate'] < interval[1]).getresults()