This commit is contained in:
wea_ondara
2020-05-08 09:25:50 +02:00
parent d6769e3356
commit 9cb9c04f92
2 changed files with 4 additions and 4 deletions

6
its.py
View File

@@ -12,7 +12,7 @@ from loader import load, dmt, cms
from sentiments import readtoxleveltxt from sentiments import readtoxleveltxt
colors = ['red', 'green', 'blue', 'orange', 'deeppink'] colors = ['red', 'green', 'blue', 'orange', 'deeppink']
thresholds = [3, 4, 5, 6] thresholds = [6, 9, 12, 15]
changedate = datetime.fromisoformat("2018-09-01T00:00:00") changedate = datetime.fromisoformat("2018-09-01T00:00:00")
@@ -72,7 +72,7 @@ def main(folder, intervl):
print("Computing full ITS") print("Computing full ITS")
t = np.reshape(np.array([i for i in range(len(datasingle)) for j in datasingle[i]]), (-1, 1)) 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.array(t)
X = np.concatenate((X, x), 1) X = np.concatenate((X, x), 1)
X = np.concatenate((X, np.multiply(t, x)), 1) X = np.concatenate((X, np.multiply(t, x)), 1)
@@ -100,7 +100,7 @@ def main(folder, intervl):
# print("iv " + str(iv)) # print("iv " + str(iv))
d = [x for (i, x) in z] 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)) 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.array(t)
X = np.concatenate((X, x), 1) X = np.concatenate((X, x), 1)
X = np.concatenate((X, np.multiply(t, x)), 1) X = np.concatenate((X, np.multiply(t, x)), 1)

View File

@@ -94,7 +94,7 @@ def main(folder, intervl):
# votes over time # votes over time
votes = readVotes(folder) votes = readVotes(folder)
fig = plt.figure(figsize=FIG_SIZE) 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: for interval in ivs:
print(interval[0].strftime("%d-%m-%Y") + " to " + interval[1].strftime("%d-%m-%Y")) 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() ivvotes = dmt(votes).filter(lambda v: interval[0] <= v['CreationDate'] < interval[1]).getresults()